diff --git a/ChangeLog b/ChangeLog index a35b057..68caac1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ vNEXT: verbose_packet now also dumps UDP packets. + print_message() restores errno, fix sslh-fork + exiting upong log errors. + v2.3.1: Fix segmentation fault in sslh-fork. diff --git a/log.c b/log.c index bd87d25..c0946df 100644 --- a/log.c +++ b/log.c @@ -107,6 +107,12 @@ void print_message(msg_info info, const char* str, ...) { va_list ap; + /* print_message() being used for logging, it is often used after system + * calls and before caller checks errno; as it itself does not do anything + * with errno (can't log an error if error logging fails), it just restores + * it on exit */ + int saved_errno = errno; + if ((*info.verbose & MSG_STDOUT) && ! cfg.inetd) { va_start(ap, str); vfprintf(stderr, str, ap); @@ -125,6 +131,8 @@ void print_message(msg_info info, const char* str, ...) fflush(logfile_fp); va_end(ap); } + + errno = saved_errno; } static int do_syslog = 1; /* Should we syslog? controled by syslog_facility = "none" */