mirror of
git://git.sv.gnu.org/nano.git
synced 2025-03-23 09:53:05 +03:00
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.html
This commit is contained in:
parent
a2b20a1915
commit
26c0a7962e
@ -1954,7 +1954,7 @@ bool write_file(const char *name, FILE *thefile, bool tmp,
|
|||||||
unlink(tempname);
|
unlink(tempname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!S_ISFIFO(st.st_mode))
|
if (!is_existing_file || !S_ISFIFO(st.st_mode))
|
||||||
#endif
|
#endif
|
||||||
/* Ensure the data has reached the disk before reporting it as written. */
|
/* Ensure the data has reached the disk before reporting it as written. */
|
||||||
if (fflush(thefile) != 0 || fsync(fileno(thefile)) != 0) {
|
if (fflush(thefile) != 0 || fsync(fileno(thefile)) != 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user