aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/gen/syslog.c
diff options
context:
space:
mode:
authorEitan Adler <eadler@FreeBSD.org>2012-06-20 06:38:41 +0000
committerEitan Adler <eadler@FreeBSD.org>2012-06-20 06:38:41 +0000
commitbf36cf8e1b6f89d66432925abc40408d99c21e6a (patch)
tree4f5562293191429097e8c125377ca5e798f6e29a /lib/libc/gen/syslog.c
parentcfc0a49549ac1f077b18668dab8eb08fc1f52ccd (diff)
downloadsrc-bf36cf8e1b6f89d66432925abc40408d99c21e6a.tar.gz
src-bf36cf8e1b6f89d66432925abc40408d99c21e6a.zip
Notes
Diffstat (limited to 'lib/libc/gen/syslog.c')
-rw-r--r--lib/libc/gen/syslog.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index de438c43b9cb..52a07827cdc9 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/un.h>
#include <netdb.h>
+#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
@@ -413,8 +414,11 @@ void
closelog(void)
{
THREAD_LOCK();
- (void)_close(LogFile);
- LogFile = -1;
+ assert(LogFile >= -1);
+ if (LogFile != -1) {
+ (void)_close(LogFile);
+ LogFile = -1;
+ }
LogTag = NULL;
status = NOCONN;
THREAD_UNLOCK();