aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc-logger.c
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@inbox.ru>2017-05-30 08:47:55 +0100
committerDoug Freed <dwfreed@mtu.edu>2017-05-30 03:47:55 -0400
commit7185e242ffaa8cd1b672fe4726502a196fd779c2 (patch)
treefd7dcc24db1c237b838208b5bcf225ad40b2bb5b /src/rc/rc-logger.c
parentec27299f4b88daa80261298fafea76ae634744d9 (diff)
rc-logger.c: fix crash on fclose(NULL) (#137)
Only close the log if we successfully opened it. Reported-by: Brian Evans <grknight@gentoo.org> Tested-by: Brian Evans <grknight@gentoo.org> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'src/rc/rc-logger.c')
-rw-r--r--src/rc/rc-logger.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rc/rc-logger.c b/src/rc/rc-logger.c
index b4bd0eae..062ce3d9 100644
--- a/src/rc/rc-logger.c
+++ b/src/rc/rc-logger.c
@@ -261,12 +261,12 @@ rc_logger_open(const char *level)
break;
}
}
+ fclose(log);
} else {
log_error = 1;
eerror("Error: fopen(%s) failed: %s", TMPLOG, strerror(errno));
}
- fclose(log);
fclose(plog);
} else {
/*