From dac67a567d8c1ffc63a38f94349ea37d2dc4f2c1 Mon Sep 17 00:00:00 2001 From: David Leadbeater Date: Sun, 6 Jul 2014 21:52:03 +0100 Subject: Check return values from some syscalls and warn if they fail --- src/core/rawlog.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/core/rawlog.c') diff --git a/src/core/rawlog.c b/src/core/rawlog.c index 20368aeb..e66f20dd 100644 --- a/src/core/rawlog.c +++ b/src/core/rawlog.c @@ -102,10 +102,15 @@ void rawlog_redirect(RAWLOG_REC *rawlog, const char *str) static void rawlog_dump(RAWLOG_REC *rawlog, int f) { GSList *tmp; + ssize_t ret = 1; - for (tmp = rawlog->lines; tmp != NULL; tmp = tmp->next) { - write(f, tmp->data, strlen((char *) tmp->data)); - write(f, "\n", 1); + for (tmp = rawlog->lines; ret && tmp != NULL; tmp = tmp->next) { + ret = write(f, tmp->data, strlen((char *) tmp->data)); + ret &= write(f, "\n", 1); + } + + if (ret <= 0) { + g_warning("rawlog write() failed: %s", strerror(errno)); } } -- cgit v1.2.3