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.
master
Benno Schulenberg 2020-05-28 14:54:53 +02:00
parent 756b95748b
commit 90772ad05b
1 changed files with 3 additions and 3 deletions

View File

@ -1477,11 +1477,11 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp)
#ifndef NANO_TINY #ifndef NANO_TINY
/* Although this sucks, it sucks less than having a single 'my system is /* Although this sucks, it sucks less than having a single 'my system is
* messed up and I'm blanket allowing insecure file writing operations'. */ * 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; static char *prevfile = NULL;
/* The last filename we were passed, so we don't keep asking this. */ /* The last filename we were passed, so we don't keep asking this. */
static int choice = 0;
if (prevfile == NULL || strcmp(filename, prevfile)) { if (prevfile == NULL || strcmp(filename, prevfile)) {
choice = do_yesno_prompt(FALSE, _("Failed to write backup file; " 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); prevfile = mallocstrcpy(prevfile, filename);
} }
return choice; return (choice == 1);
} }
/* Transform the specified backup directory to an absolute path, /* Transform the specified backup directory to an absolute path,