From 47953bd6ac4c2b837aea0c17e1659902b3f4ba51 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 29 May 2020 10:58:11 +0200 Subject: [PATCH] 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. --- src/files.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index f99def54..611044ab 100644 --- a/src/files.c +++ b/src/files.c @@ -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;