From 8289f360757870b56a15576a20e79e1f2ca30fef Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sat, 13 Feb 2016 13:15:33 +0100 Subject: [PATCH] Check the return value of open() in rawlog.c --- src/core/rawlog.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/rawlog.c b/src/core/rawlog.c index 2b46c50d..5927e730 100644 --- a/src/core/rawlog.c +++ b/src/core/rawlog.c @@ -157,6 +157,11 @@ void rawlog_save(RAWLOG_REC *rawlog, const char *fname) f = open(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode); g_free(path); + if (f < 0) { + g_warning("rawlog open() failed: %s", strerror(errno)); + return; + } + rawlog_dump(rawlog, f); close(f); }