# HG changeset patch # User Roy Marples # Date 1602252417 -3600 # Node ID 9c7bd8bd8729eb5fe508d5d12ff71dbb0378f3de # Parent 5aedb51585b6ed4a97d4413a1f67ff399101a104 privsep: Always try and open syslog Even if we don't print as otherwise we can't in a chroot. diff -r 5aedb51585b6 -r 9c7bd8bd8729 src/logerr.c --- a/src/logerr.c Fri Oct 09 14:45:57 2020 +0100 +++ b/src/logerr.c Fri Oct 09 15:06:57 2020 +0100 @@ -366,20 +366,24 @@ logopen(const char *path) { struct logctx *ctx = &_logctx; + int opts = 0; /* Cache timezone */ tzset(); (void)setvbuf(stderr, ctx->log_buf, _IOLBF, sizeof(ctx->log_buf)); - if (path == NULL) { - int opts = 0; + if (!(ctx->log_opts & LOGERR_LOG)) + return 1; - if (ctx->log_opts & LOGERR_LOG_PID) - opts |= LOG_PID; - openlog(NULL, opts, LOGERR_SYSLOG_FACILITY); +#ifdef LOG_NDELAY + opts |= LOG_NDELAY; +#endif + if (ctx->log_opts & LOGERR_LOG_PID) + opts |= LOG_PID; + openlog(NULL, opts, LOGERR_SYSLOG_FACILITY); + if (path == NULL) return 1; - } #ifndef SMALL if ((ctx->log_file = fopen(path, "ae")) == NULL)