]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
warnx: Save errno across calls that might change it.
authorWarner Losh <imp@FreeBSD.org>
Fri, 23 Oct 2020 23:56:00 +0000 (23:56 +0000)
committerWarner Losh <imp@FreeBSD.org>
Fri, 23 Oct 2020 23:56:00 +0000 (23:56 +0000)
commit4e0771b2da184592e35952c8d4fdf8a9a8858ced
treecdf7cd2702ccbbc08e2e2f65cb1392445fd7b858
parent3e7449a37b92e7b5333c4be704a191661f038a9a
warnx: Save errno across calls that might change it.

When warn() family of functions is being used after err_set_file() has
been set to, for example, /dev/null, errno is being clobbered,
rendering it unreliable after, for example, procstat_getpathname()
when it is supposed to emit a warning. Then the errno is changed to
Inappropriate ioctl for device, destroying the original value (via
calls to fprintf()functions).

Submitted by: Juraj Lutter
Differential Revision: https://reviews.freebsd.org/D26871
lib/libc/gen/err.c