From 586d22109b8b6fc9909669fafb1a3c20b2aae6ab Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 29 May 2020 11:17:08 +0200 Subject: [PATCH] files: show a warning when writing a backup fails, before prompting Make the behavior similar to that of the other failure cases. Also, plug a tiny memory leak. --- src/files.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index 611044ab..57439840 100644 --- a/src/files.c +++ b/src/files.c @@ -1688,10 +1688,12 @@ bool write_file(const char *name, FILE *thefile, bool tmp, goto cleanup_and_exit; } else if (verdict > 0) { fclose(backup_file); + warn_and_briefly_pause(_("Cannot write backup")); if (user_wants_to_proceed()) goto skip_backup; - statusline(HUSH, _("Error writing backup file %s: %s"), + statusline(HUSH, _("Cannot write backup %s: %s"), backupname, strerror(errno)); + free(backupname); goto cleanup_and_exit; }