commit e1f80b9707a7165eeb6c06107cf3f46e5f026619
parent 6b4e7d0f789cfb9c654ee450df0fa8a3fecfb5b4
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 29 May 2020 17:12:45 +0200
tweaks: move a function to a more logical place
Initialization should come first.
Diffstat:
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -1475,20 +1475,6 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp)
#endif
#ifndef NANO_TINY
-/* Although this sucks, it sucks less than having a single 'my system is
- * messed up and I'm blanket allowing insecure file writing operations'. */
-bool user_wants_to_proceed(void)
-{
- warn_and_briefly_pause(strerror(errno));
-
- if (errno == ENOSPC) {
- currmenu = MMOST;
- return FALSE;
- } else
- return (do_yesno_prompt(FALSE, _("Cannot make backup; "
- "continue and save actual file? ")) == 1);
-}
-
/* Transform the specified backup directory to an absolute path,
* and verify that it is usable. */
void init_backup_dir(void)
@@ -1503,6 +1489,21 @@ void init_backup_dir(void)
free(backup_dir);
backup_dir = charealloc(target, strlen(target) + 1);
}
+
+/* Report the reason why the backup failed and ask what to do. Return TRUE
+ * when the user wants to save the file itself anyway. But refuse to go on
+ * if the backup failed due to a lack of space. */
+bool user_wants_to_proceed(void)
+{
+ warn_and_briefly_pause(strerror(errno));
+
+ if (errno == ENOSPC) {
+ currmenu = MMOST;
+ return FALSE;
+ } else
+ return (do_yesno_prompt(FALSE, _("Cannot make backup; "
+ "continue and save the file? ")) == 1);
+}
#endif /* !NANO_TINY */
/* Read all data from inn, and write it to out. File inn must be open for