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, Mar 25, 8:31 AM
Unknown Object (File)
Sat, Mar 21, 7:45 PM
Unknown Object (File)
Sat, Mar 14, 11:42 PM
Unknown Object (File)
Thu, Mar 12, 11:08 AM
Unknown Object (File)
Thu, Mar 12, 6:43 AM
Unknown Object (File)
Sat, Mar 7, 7:55 PM
Unknown Object (File)
Sat, Mar 7, 10:07 AM
Unknown Object (File)
Mar 2 2026, 7:14 AM
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