]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
warnx: Save errno across calls that might change it.
authorimp <imp@FreeBSD.org>
Fri, 23 Oct 2020 23:56:00 +0000 (23:56 +0000)
committerimp <imp@FreeBSD.org>
Fri, 23 Oct 2020 23:56:00 +0000 (23:56 +0000)
commitd8b432de64e1274e92cf51517fb78095ba49b4a8
treecdf7cd2702ccbbc08e2e2f65cb1392445fd7b858
parent68e3a058d6495f877d54292196ec9cd1e64cb26f
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