]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(XWRITE): Guard against calling xwrite with n_bytes == 0.
authorJim Meyering <jim@meyering.net>
Tue, 1 Nov 1994 22:38:11 +0000 (22:38 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 1 Nov 1994 22:38:11 +0000 (22:38 +0000)
src/tail.c

index 138f93a0c433823b188deed3539e5658f325b6d1..7fccd9e3a0e32fa270d5ae892b646fc11fce1b26 100644 (file)
@@ -62,7 +62,7 @@
     {                                                                  \
       assert ((fd) == 1);                                              \
       assert ((n_bytes) >= 0);                                         \
-      if (fwrite ((buffer), 1, (n_bytes), stdout) == 0)                        \
+      if (n_bytes > 0 && fwrite ((buffer), 1, (n_bytes), stdout) == 0) \
        error (1, errno, "write error");                                \
     }                                                                  \
   while (0)