From 6eaeb7737d95661ca31b162977ac443ffeb7b0b3 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <vda.linux@googlemail.com>
Date: Fri, 12 Mar 2010 22:16:25 +0100
Subject: tailk: fix error detected by testsuite

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
---
 coreutils/tail.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/coreutils/tail.c b/coreutils/tail.c
index 83768d420..8fc22f562 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -241,7 +241,8 @@ int tail_main(int argc, char **argv)
 						} while (nwrite);
 					}
 				}
-				xwrite(STDOUT_FILENO, buf + nread - nwrite, nwrite);
+				if (nwrite > 0)
+					xwrite(STDOUT_FILENO, buf + nread - nwrite, nwrite);
 			} else if (count) {
 				if (COUNT_BYTES) {
 					taillen += nread;
-- 
cgit v1.2.3