files: check for a fifo only when it is an existing file
To avoid referencing an uninitialized value. Reported-by: André Kugland <kugland@gmail.com> https://lists.gnu.org/archive/html/nano-devel/2021-09/msg00031.htmlmaster
parent
a2b20a1915
commit
26c0a7962e
|
@ -1954,7 +1954,7 @@ bool write_file(const char *name, FILE *thefile, bool tmp,
|
|||
unlink(tempname);
|
||||
}
|
||||
|
||||
if (!S_ISFIFO(st.st_mode))
|
||||
if (!is_existing_file || !S_ISFIFO(st.st_mode))
|
||||
#endif
|
||||
/* Ensure the data has reached the disk before reporting it as written. */
|
||||
if (fflush(thefile) != 0 || fsync(fileno(thefile)) != 0) {
|
||||
|
|
Loading…
Reference in New Issue