commit 160f07babae5849dba58d7fd6e24f3a6656285b4
parent 822d764d27749e831d1b01de3c2327ea2f5745e4
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 28 May 2020 19:29:08 +0200
tweaks: simplify an error message, by mentioning just the main point
Also, correct a comment.
Diffstat:
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -1632,21 +1632,17 @@ bool write_file(const char *name, FILE *thefile, bool tmp,
backupname = charalloc(strlen(backup_dir) + strlen(backuptemp) + 1);
sprintf(backupname, "%s%s", backup_dir, backuptemp);
free(backuptemp);
+
backuptemp = get_next_filename(backupname, "~");
+ free(backupname);
+ backupname = backuptemp;
- if (*backuptemp == '\0') {
- statusline(HUSH, _("Error writing backup file %s: %s"),
- backupname, _("Too many backup files?"));
- free(backuptemp);
+ /* If all numbered backup names are taken, the user must
+ * be fond of backups. Thus, without one, do not go on. */
+ if (*backupname == '\0') {
+ statusline(ALERT, _("Too many existing backup files"));
free(backupname);
- /* If we can't write to the backup, DON'T go on, since
- * whatever caused the backup-file write to fail (e.g.
- * disk full) may well cause the real file write to fail
- * too, which means we could lose the original! */
goto cleanup_and_exit;
- } else {
- free(backupname);
- backupname = backuptemp;
}
}