Date: Sun, 18 Dec 2022 02:55:26 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268436] [libc] syslog() and vsyslog() do not preserve the errno at the time of the call. Message-ID: <bug-268436-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268436 Bug ID: 268436 Summary: [libc] syslog() and vsyslog() do not preserve the errno at the time of the call. Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: hodong@nimfsoft.art Hello. Since syslog() and vsyslog() do not preserve errno at the time of the call, errno may change after calling syslog. https://cgit.freebsd.org/src/tree/lib/libc/gen/syslog.c https://github.com/freebsd/freebsd-src/blob/main/lib/libc/gen/syslog.c I suggest this patch. --- a/syslog.c +++ b/syslog.c @@ -348,7 +348,9 @@ vsyslog(int pri, const char *fmt, va_list ap) THREAD_LOCK(); pthread_cleanup_push(syslog_cancel_cleanup, NULL); + int saved_errno =3D errno; vsyslog1(pri, fmt, ap); + errno =3D saved_errno; pthread_cleanup_pop(1); } --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268436-227>