[PATCH v9 34/41] write_or_die: use warning() instead of fprintf(stderr, ...)
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Jul 30, 2016, 17:25 UTC
- Message-ID
- <20160730172509.22939-35-chriscool@tuxfamily.org>
- In-Reply-To
- <20160730172509.22939-1-chriscool@tuxfamily.org>
In write_or_whine_pipe() and write_or_whine() when write_in_full() returns an error, let's print the errno related error message using warning() instead of fprintf(stderr, ...).
This makes it possible to change the way it is handled by changing the current warn routine in usage.c.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> --- write_or_die.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/write_or_die.c b/write_or_die.c index 9816879..26eeec8 100644 --- a/write_or_die.c +++ b/write_or_die.c @@ -87,8 +87,7 @@ int write_or_whine_pipe(int fd, const void *buf, size_t count, const char *msg) { if (write_in_full(fd, buf, count) < 0) { check_pipe(errno); - fprintf(stderr, "%s: write error (%s)\n", - msg, strerror(errno)); + warning("%s: write error (%s)\n", msg, strerror(errno)); return 0; }
-- 2.9.2.558.gf53e569