commit 26c0a7962e97bfc281decb3da7efa658254f2bca
parent a2b20a19152b764b099a32392110b927a28f4292
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 28 Sep 2021 09:31:52 +0200
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
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/files.c b/src/files.c
@@ -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) {