From 08dc6734b90389c357c73544023ec614e43b0860 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Sat, 29 Jul 2017 09:25:51 +0100 Subject: [PATCH] When rawlog open fails, there's no point in trying to write. Don't. Signed-off-by: Edward Tomasz Napierala --- src/core/rawlog.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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); - if (rawlog->handle == -1) { - g_warning("rawlog open() failed: %s", strerror(errno)); - } g_free(path); + if (rawlog->handle == -1) { + g_warning("rawlog open() failed: %s", strerror(errno)); + return; + } + rawlog_dump(rawlog, rawlog->handle); - rawlog->logging = rawlog->handle != -1; + rawlog->logging = TRUE; } void rawlog_close(RAWLOG_REC *rawlog)