save the original file, if possible, since that's better than
saving nothing. (DLR, problem found by Bill Marcum, solution
suggested by Jordi)
+ - Clarify the error message when writing a temporary file for
+ prepending fails. (DLR)
- rcfile.c:
parse_argument()
- Rename variable ptr_bak to ptr_save, for consistency. (DLR)
statusbar(_("Error reading %s: %s"), realname,
strerror(errno));
beep();
- /* If we can't read from the original file, and we're
- * prepending, get out, since we won't be able to save
- * either the backup or the original file. If we're not
- * prepending, go on, since only saving the original
- * file is better than saving nothing. */
- if (append == PREPEND)
- goto cleanup_and_exit;
- else
- goto skip_backup;
+ /* If we can't read from the original file, go on, since
+ * only saving the original file is better than saving
+ * nothing. */
+ goto skip_backup;
}
}
int fd_source;
FILE *f_source = NULL;
+ if (f == NULL) {
+ f = fopen(realname, "rb");
+
+ if (f == NULL) {
+ statusbar(_("Error reading %s: %s"), realname,
+ strerror(errno));
+ beep();
+ goto cleanup_and_exit;
+ }
+ }
+
tempname = safe_tempfile(&f);
if (tempname == NULL) {
- statusbar(_("Prepending to %s failed: %s"), realname,
+ statusbar(_("Could not create temp file: %s"),
strerror(errno));
goto cleanup_and_exit;
}