diff options
author | David Leadbeater <dgl@dgl.cx> | 2014-07-06 21:52:03 +0100 |
---|---|---|
committer | David Leadbeater <dgl@dgl.cx> | 2014-07-06 21:52:03 +0100 |
commit | dac67a567d8c1ffc63a38f94349ea37d2dc4f2c1 (patch) | |
tree | 47553ef10a36ebda7fa79ce434a7d7611a271d51 /src/core/rawlog.c | |
parent | 85d9fa1922a5f408dd40f18287f01135dd826e4d (diff) | |
download | irssi-dac67a567d8c1ffc63a38f94349ea37d2dc4f2c1.zip |
Check return values from some syscalls and warn if they fail
Diffstat (limited to 'src/core/rawlog.c')
-rw-r--r-- | src/core/rawlog.c | 11 |
1 files changed, 8 insertions, 3 deletions
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)); } } |