summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2015-09-24 12:03:59 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2015-09-24 12:03:59 +0000
commitf16021874f46e9695f0c629c39718da776d4894c (patch)
treec0a17a00adeac3143d29e564236bca61a4e8a647 /usr.bin
parent32a01671b3aa01e0ec24b8d19160e2b85a17bdb0 (diff)
Do not leak log file descriptor.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/log.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/tmux/log.c b/usr.bin/tmux/log.c
index 51eec207250..2428481a138 100644
--- a/usr.bin/tmux/log.c
+++ b/usr.bin/tmux/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.16 2015/09/14 12:12:24 nicm Exp $ */
+/* $OpenBSD: log.c,v 1.17 2015/09/24 12:03:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -42,6 +42,9 @@ log_event_cb(unused int severity, const char *msg)
void
log_open(const char *path)
{
+ if (log_file != NULL)
+ fclose(log_file);
+
log_file = fopen(path, "w");
if (log_file == NULL)
return;