nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 586d22109b8b6fc9909669fafb1a3c20b2aae6ab
parent 47953bd6ac4c2b837aea0c17e1659902b3f4ba51
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 29 May 2020 11:17:08 +0200

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.

Diffstat:
Msrc/files.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 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; }