tweaks: remove two superfluous conditions when prepending
When prepending, we cannot be writing to a temp file, so 'stream' (and thus 'f') will necessarily be NULL.master
parent
36270748dc
commit
40c067133a
|
@ -1724,7 +1724,6 @@ bool write_file(const char *name, FILE *stream, bool tmp,
|
||||||
int fd_source;
|
int fd_source;
|
||||||
FILE *f_source = NULL;
|
FILE *f_source = NULL;
|
||||||
|
|
||||||
if (f == NULL) {
|
|
||||||
f = fopen(realname, "rb");
|
f = fopen(realname, "rb");
|
||||||
|
|
||||||
if (f == NULL) {
|
if (f == NULL) {
|
||||||
|
@ -1732,7 +1731,6 @@ bool write_file(const char *name, FILE *stream, bool tmp,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
tempname = safe_tempfile(&f);
|
tempname = safe_tempfile(&f);
|
||||||
|
|
||||||
|
@ -1742,7 +1740,6 @@ bool write_file(const char *name, FILE *stream, bool tmp,
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream == NULL) {
|
|
||||||
fd_source = open(realname, O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
fd_source = open(realname, O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||||
|
|
||||||
if (fd_source != -1) {
|
if (fd_source != -1) {
|
||||||
|
@ -1756,7 +1753,6 @@ bool write_file(const char *name, FILE *stream, bool tmp,
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (f_source == NULL || copy_file(f_source, f, TRUE) != 0) {
|
if (f_source == NULL || copy_file(f_source, f, TRUE) != 0) {
|
||||||
statusline(ALERT, _("Error writing temp file: %s"),
|
statusline(ALERT, _("Error writing temp file: %s"),
|
||||||
|
|
Loading…
Reference in New Issue