summaryrefslogtreecommitdiff
path: root/src/tail.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1994-11-01 22:38:11 +0000
committerJim Meyering <jim@meyering.net>1994-11-01 22:38:11 +0000
commit32340b45e70eeff17f153615e8f3e43712cb7ba9 (patch)
treeb86d6f6d25a9ef704606932e8d66f7c68be1a0ff /src/tail.c
parent7a5462a0b71b8b6bfe5f71cad341f2a149aa0535 (diff)
downloadcoreutils-32340b45e70eeff17f153615e8f3e43712cb7ba9.tar.xz
(XWRITE): Guard against calling xwrite with n_bytes == 0.
Diffstat (limited to 'src/tail.c')
-rw-r--r--src/tail.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tail.c b/src/tail.c
index 138f93a0c..7fccd9e3a 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -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)