From 32340b45e70eeff17f153615e8f3e43712cb7ba9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 1 Nov 1994 22:38:11 +0000 Subject: [PATCH] (XWRITE): Guard against calling xwrite with n_bytes == 0. --- src/tail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tail.c b/src/tail.c index 138f93a0c4..7fccd9e3a0 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) -- 2.47.3