From 90772ad05b186241136123890c6ac352de39f20f Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 28 May 2020 14:54:53 +0200 Subject: [PATCH] backup: do not understand ^C as "Yes" when asking whether to continue This fixes https://savannah.gnu.org/bugs/?58443. Bug existed since version 2.3.0, commit 3d411188. --- src/files.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/files.c b/src/files.c index 9f0a27f4..b66f74a6 100644 --- a/src/files.c +++ b/src/files.c @@ -1477,11 +1477,11 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp) #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'. */ -int prompt_failed_backupwrite(const char *filename) +bool prompt_failed_backupwrite(const char *filename) { - static int choice; static char *prevfile = NULL; /* The last filename we were passed, so we don't keep asking this. */ + static int choice = 0; if (prevfile == NULL || strcmp(filename, prevfile)) { choice = do_yesno_prompt(FALSE, _("Failed to write backup file; " @@ -1489,7 +1489,7 @@ int prompt_failed_backupwrite(const char *filename) prevfile = mallocstrcpy(prevfile, filename); } - return choice; + return (choice == 1); } /* Transform the specified backup directory to an absolute path,