aboutsummaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'log.c')
-rw-r--r--log.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/log.c b/log.c
index 9d0e267..e67ae7c 100644
--- a/log.c
+++ b/log.c
@@ -299,11 +299,11 @@ handle_imsg_log(struct imsgbuf *ibuf, struct imsg *imsg, size_t datalen)
static void
handle_imsg_log_type(struct imsgbuf *ibuf, struct imsg *imsg, size_t datalen)
{
- if (log != NULL) {
+ if (log != NULL && log != stderr) {
fflush(log);
fclose(log);
- log = NULL;
}
+ log = NULL;
if (imsg->fd != -1) {
if ((log = fdopen(imsg->fd, "a")) == NULL) {
@@ -324,6 +324,8 @@ handle_dispatch_imsg(int fd, short ev, void *d)
int
logger_main(int fd, struct imsgbuf *ibuf)
{
+ log = stderr;
+
event_init();
event_set(&imsgev, fd, EV_READ | EV_PERSIST, &handle_dispatch_imsg, ibuf);