From 9b1d91488f6b5c72b650bccf8ac7e2b668c69da7 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 7 Feb 2011 10:59:29 +0100 Subject: Only print error if there actually was one write() returning 0 there is fine and not considered an error. --- inotail.c | 6 ++++-- 1 file 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; } -- cgit v1.2.3-54-g00ecf move'>nds-private-remove net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode: