tweaks: exclude the file-prepending code from the tiny version
The prepending and appending toggles are not available in tiny nano, so there is no need to have the code either.
Этот коммит содержится в:
родитель
8e1ce7034d
Коммит
f82eefa303
@ -1782,6 +1782,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
|||||||
umask(original_umask);
|
umask(original_umask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
/* If we're prepending, copy the file to a temp file. */
|
/* If we're prepending, copy the file to a temp file. */
|
||||||
if (method == PREPEND) {
|
if (method == PREPEND) {
|
||||||
int fd_source;
|
int fd_source;
|
||||||
@ -1828,6 +1829,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
|||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
if (f_open == NULL) {
|
if (f_open == NULL) {
|
||||||
/* Now open the file in place. Use O_EXCL if tmp is TRUE. This
|
/* Now open the file in place. Use O_EXCL if tmp is TRUE. This
|
||||||
@ -1909,6 +1911,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
|||||||
lineswritten++;
|
lineswritten++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
/* If we're prepending, open the temp file, and append it to f. */
|
/* If we're prepending, open the temp file, and append it to f. */
|
||||||
if (method == PREPEND) {
|
if (method == PREPEND) {
|
||||||
int fd_source;
|
int fd_source;
|
||||||
@ -1936,7 +1939,9 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
unlink(tempname);
|
unlink(tempname);
|
||||||
} else if (fclose(f) != 0) {
|
} else
|
||||||
|
#endif
|
||||||
|
if (fclose(f) != 0) {
|
||||||
statusline(ALERT, _("Error writing %s: %s"), realname,
|
statusline(ALERT, _("Error writing %s: %s"), realname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user