summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inotail.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/inotail.c b/inotail.c
index d1c30d5..9d79d01 100644
--- a/inotail.c
+++ b/inotail.c
@@ -421,13 +421,15 @@ static int tail_pipe_lines(struct file_struct *f, unsigned long n_lines)
if ((rc = write(STDOUT_FILENO, p, tmp->buf + tmp->n_bytes - p)) <= 0) {
/* e.g. when writing to a pipe which gets closed */
- fprintf(stderr, "Error: Could not write to stdout (%s)\n", strerror(errno));
+ if (rc)
+ fprintf(stderr, "Error: Could not write to stdout (%s)\n", strerror(errno));
goto out;
}
for (tmp = tmp->next; tmp; tmp = tmp->next)
if ((rc = write(STDOUT_FILENO, tmp->buf, tmp->n_bytes)) <= 0) {
- fprintf(stderr, "Error: Could not write to stdout (%s)\n", strerror(errno));
+ if (rc)
+ fprintf(stderr, "Error: Could not write to stdout (%s)\n", strerror(errno));
goto out;
}