tweaks: fold two fragments of code together

This commit is contained in:
Benno Schulenberg
2026-04-17 12:15:24 +02:00
parent cad7948400
commit 22e2ea3cf4

View File

@@ -1889,16 +1889,9 @@ bool write_file(const char *name, FILE *thefile, bool normal,
break;
}
#ifndef NANO_TINY
if (openfile->fmt == DOS_FILE) {
if (putc('\r', thefile) == EOF) {
statusline(ALERT, _("Error writing %s: %s"), realname, strerror(errno));
fclose(thefile);
goto cleanup_and_exit;
}
}
#endif
if (putc('\n', thefile) == EOF) {
/* Write the newline (preceded with a carriage return for a DOS file). */
if ((openfile->fmt == DOS_FILE && putc('\r', thefile) == EOF) ||
putc('\n', thefile) == EOF) {
statusline(ALERT, _("Error writing %s: %s"), realname, strerror(errno));
fclose(thefile);
goto cleanup_and_exit;