Page MenuHomeFreeBSD

printf(): Save errno earlier.
ClosedPublic

Authored by des on Sep 20 2024, 4:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 6 2025, 3:51 AM
Unknown Object (File)
Feb 24 2025, 10:29 AM
Unknown Object (File)
Feb 22 2025, 2:18 PM
Unknown Object (File)
Feb 22 2025, 1:59 PM
Unknown Object (File)
Feb 10 2025, 9:05 AM
Unknown Object (File)
Feb 5 2025, 6:50 AM
Unknown Object (File)
Jan 30 2025, 7:42 PM
Unknown Object (File)
Jan 26 2025, 8:38 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