summaryrefslogtreecommitdiff
path: root/src/core/rawlog.c
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2017-07-29 09:25:51 +0100
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2017-07-29 10:40:42 +0100
commit08dc6734b90389c357c73544023ec614e43b0860 (patch)
tree1df1aac25a824bb0a7849832f7942a3bb2be0d9b /src/core/rawlog.c
parent42b5e89f6e9fba17111f67441e25db38a737a3bd (diff)
downloadirssi-08dc6734b90389c357c73544023ec614e43b0860.zip
When rawlog open fails, there's no point in trying to write. Don't.
Signed-off-by: Edward Tomasz Napierala <trasz@FreeBSD.org>
Diffstat (limited to 'src/core/rawlog.c')
-rw-r--r--src/core/rawlog.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/rawlog.c b/src/core/rawlog.c
index d929682a..43f140f3 100644
--- a/src/core/rawlog.c
+++ b/src/core/rawlog.c
@@ -128,13 +128,15 @@ void rawlog_open(RAWLOG_REC *rawlog, const char *fname)
path = convert_home(fname);
rawlog->handle = open(path, O_WRONLY | O_APPEND | O_CREAT,
log_file_create_mode);
+ g_free(path);
+
if (rawlog->handle == -1) {
g_warning("rawlog open() failed: %s", strerror(errno));
+ return;
}
- g_free(path);
rawlog_dump(rawlog, rawlog->handle);
- rawlog->logging = rawlog->handle != -1;
+ rawlog->logging = TRUE;
}
void rawlog_close(RAWLOG_REC *rawlog)