summaryrefslogtreecommitdiffstats
path: root/log.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-05-30 15:01:21 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-05-30 15:01:21 +0000
commit021e95b09ff8f07749bc45d61f8d7ca24a623263 (patch)
treec60454f3584b6334310921e04ef193be7bb763b6 /log.c
parentdb20f2d907caaa44797ec2f062903ba060aa4374 (diff)
Do not use stderr for log file and don't call log_close when not needed.
Diffstat (limited to 'log.c')
-rw-r--r--log.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/log.c b/log.c
index dbae1972..2f1400cb 100644
--- a/log.c
+++ b/log.c
@@ -28,7 +28,7 @@
#include "tmux.h"
/* Log file, if needed. */
-FILE *log_file = stderr;
+FILE *log_file;
/* Debug level. */
int log_level = 0;
@@ -63,7 +63,7 @@ log_open(int level, const char *path)
void
log_close(void)
{
- if (log_file != stderr)
+ if (log_file != NULL)
fclose(log_file);
event_set_log_callback(NULL);
@@ -75,6 +75,9 @@ log_vwrite(const char *msg, va_list ap)
{
char *fmt;
+ if (log_file == NULL)
+ return;
+
if (asprintf(&fmt, "%s\n", msg) == -1)
exit(1);
if (vfprintf(log_file, fmt, ap) == -1)