From 160f07babae5849dba58d7fd6e24f3a6656285b4 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 28 May 2020 19:29:08 +0200 Subject: [PATCH] tweaks: simplify an error message, by mentioning just the main point Also, correct a comment. --- src/files.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/files.c b/src/files.c index 02f94d65..31e00ced 100644 --- 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, "~"); - if (*backuptemp == '\0') { - statusline(HUSH, _("Error writing backup file %s: %s"), - backupname, _("Too many backup files?")); - free(backuptemp); + backuptemp = get_next_filename(backupname, "~"); + free(backupname); + backupname = 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; } }