files: also when creating a backup fails, ask the user whether to proceed

When asking this question when deleting fails or writing fails,
it should be asked too when creating fails.  Otherwise the user
is blocked from saving the file -- until she realizes that maybe
toggling off backups would help.
master
Benno Schulenberg 2020-05-29 10:58:11 +02:00
parent 11d3b01050
commit 47953bd6ac
1 changed files with 4 additions and 1 deletions

View File

@ -1660,7 +1660,10 @@ bool write_file(const char *name, FILE *thefile, bool tmp,
backup_file = fdopen(backup_fd, "wb");
if (backup_file == NULL) {
statusline(HUSH, _("Error writing backup file %s: %s"),
warn_and_briefly_pause(_("Cannot create backup file"));
if (user_wants_to_proceed())
goto skip_backup;
statusline(HUSH, _("Cannot create backup %s: %s"),
backupname, strerror(errno));
free(backupname);
goto cleanup_and_exit;