Page MenuHomeFreeBSD

printf(): Save errno earlier.
ClosedPublic

Authored by des on Sep 20 2024, 4:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jun 3, 9:41 PM
Unknown Object (File)
May 13 2026, 5:50 PM
Unknown Object (File)
May 13 2026, 5:50 PM
Unknown Object (File)
May 13 2026, 5:35 PM
Unknown Object (File)
Apr 19 2026, 3:17 AM
Unknown Object (File)
Apr 18 2026, 6:02 AM
Unknown Object (File)
Apr 18 2026, 1:55 AM
Unknown Object (File)
Apr 15 2026, 6:42 PM
Subscribers

Details

Summary

The manual page says %m is replaced with “the string representation of
the error code stored in the errno variable at the beginning of the
call”. However, we don't actually save errno until fairly late in
__vfprintf(). Make sure it is saved before we do anything that
might perturb errno.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable