files: give a more precise warning when deleting an existing backup fails

This addresses https://savannah.gnu.org/bugs/?58410.
master
Benno Schulenberg 2020-05-29 10:48:01 +02:00
parent eddd8963e7
commit 11d3b01050
1 changed files with 2 additions and 1 deletions

View File

@ -1639,9 +1639,10 @@ bool write_file(const char *name, FILE *thefile, bool tmp,
/* Now first try to delete an existing backup file. */
if (unlink(backupname) < 0 && errno != ENOENT && !ISSET(INSECURE_BACKUP)) {
warn_and_briefly_pause(_("Cannot delete existing backup"));
if (user_wants_to_proceed())
goto skip_backup;
statusline(HUSH, _("Error writing backup file %s: %s"),
statusline(HUSH, _("Cannot delete backup %s: %s"),
backupname, strerror(errno));
free(backupname);
goto cleanup_and_exit;