From e1f80b9707a7165eeb6c06107cf3f46e5f026619 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 29 May 2020 17:12:45 +0200 Subject: [PATCH] tweaks: move a function to a more logical place Initialization should come first. --- src/files.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/files.c b/src/files.c index e6705710..be9f00aa 100644 --- 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