tailk: fix error detected by testsuite
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 12 Mar 2010 21:16:25 +0000 (22:16 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 12 Mar 2010 21:16:25 +0000 (22:16 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/tail.c

index 83768d4208c54470f2c2f5bdd467d77719e0218f..8fc22f562eff7c8b98eb6e3e54591baeb7b697ff 100644 (file)
@@ -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;