summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@0x90.dk>2014-08-05 21:21:02 +0200
committerAlexander Færøy <ahf@0x90.dk>2014-08-05 21:21:02 +0200
commit18a0cfa9159dd71595e0651532fe90d734df713e (patch)
tree46500ffacdec747fe5c11238a7c5d839a00b7255
parent1933c92532702f5ec674159e8c70f98c596a475a (diff)
parent1dbc3dba78833885e8fb20f3be648fb89c91ef23 (diff)
downloadirssi-18a0cfa9159dd71595e0651532fe90d734df713e.zip
Merge pull request #121 from dgl/rawlog-fix
Fix rawlog saving after dac67a5 broke it
-rw-r--r--src/core/rawlog.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/rawlog.c b/src/core/rawlog.c
index e66f20dd..2fa6b850 100644
--- a/src/core/rawlog.c
+++ b/src/core/rawlog.c
@@ -102,14 +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;
+ ssize_t ret = 0;
- for (tmp = rawlog->lines; ret && tmp != NULL; tmp = tmp->next) {
+ for (tmp = rawlog->lines; ret != -1 && tmp != NULL; tmp = tmp->next) {
ret = write(f, tmp->data, strlen((char *) tmp->data));
- ret &= write(f, "\n", 1);
- }
+ if (ret != -1)
+ ret = write(f, "\n", 1);
+ }
- if (ret <= 0) {
+ if (ret == -1) {
g_warning("rawlog write() failed: %s", strerror(errno));
}
}