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.master
parent
47953bd6ac
commit
586d22109b
|
@ -1688,10 +1688,12 @@ bool write_file(const char *name, FILE *thefile, bool tmp,
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
} else if (verdict > 0) {
|
} else if (verdict > 0) {
|
||||||
fclose(backup_file);
|
fclose(backup_file);
|
||||||
|
warn_and_briefly_pause(_("Cannot write backup"));
|
||||||
if (user_wants_to_proceed())
|
if (user_wants_to_proceed())
|
||||||
goto skip_backup;
|
goto skip_backup;
|
||||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
statusline(HUSH, _("Cannot write backup %s: %s"),
|
||||||
backupname, strerror(errno));
|
backupname, strerror(errno));
|
||||||
|
free(backupname);
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue