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
Benno Schulenberg 2019-10-16 15:47:35 +02:00
parent 36270748dc
commit 40c067133a
1 changed files with 0 additions and 4 deletions

View File

@ -1724,7 +1724,6 @@ bool write_file(const char *name, FILE *stream, bool tmp,
int fd_source;
FILE *f_source = NULL;
if (f == NULL) {
f = fopen(realname, "rb");
if (f == NULL) {
@ -1732,7 +1731,6 @@ bool write_file(const char *name, FILE *stream, bool tmp,
strerror(errno));
goto cleanup_and_exit;
}
}
tempname = safe_tempfile(&f);
@ -1742,7 +1740,6 @@ bool write_file(const char *name, FILE *stream, bool tmp,
goto cleanup_and_exit;
}
if (stream == NULL) {
fd_source = open(realname, O_RDONLY | O_CREAT, S_IRUSR | S_IWUSR);
if (fd_source != -1) {
@ -1756,7 +1753,6 @@ bool write_file(const char *name, FILE *stream, bool tmp,
goto cleanup_and_exit;
}
}
}
if (f_source == NULL || copy_file(f_source, f, TRUE) != 0) {
statusline(ALERT, _("Error writing temp file: %s"),