libsyslog: fix loss of logger messages on failed connect()

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2022-07-27 18:12:19 +02:00
parent ef67ecae12
commit 3086637768

View File

@ -534,9 +534,11 @@ openlog_unlocked_r(const char *ident, int logstat, int logfac,
if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0) if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
data->log_fac = logfac; data->log_fac = logfac;
if (data->log_stat & LOG_NDELAY) /* open immediately */ if (data->log_stat & LOG_NDELAY) { /* open immediately */
connectlog_r(data); connectlog_r(data);
if (data->log_connected)
data->log_opened = 1;
} else
data->log_opened = 1; data->log_opened = 1;
} }