# # Description: reconnects to log socket if a write fails with # ECONNREFUSED or ENOTCONN -- similar to reopen # in syslog routines provided by glibc. # Happens if the log socket (provided by syslog # daemon) has been reopened. Can be triggered by # "rcsyslog reload" while syslog-ng is used. # See also Bugzilla Bug #27971. # # Author: mt@suse.de # --- syslog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- syslog.c +++ syslog.c 2022-10-14 13:04:57.692223266 +0000 @@ -177,7 +177,8 @@ vsyslog(pri, fmt, ap) && (errno == ECONNRESET || errno == ENOTCONN || errno == ECONNREFUSED)) { closelog(); openlog(LogTag, LogStat | LOG_NDELAY, LogFacility); - result = write(LogFile, tbuf, cnt + 1); + if (connected) + result = write(LogFile, tbuf, cnt + 1); } if (result >= 0 || !(LogStat&LOG_CONS))