commit 47953bd6ac4c2b837aea0c17e1659902b3f4ba51
parent 11d3b01050af8b66debd601507b8e770af23a168
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 29 May 2020 10:58:11 +0200
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.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git 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;