Page MenuHomeFreeBSD

printf(): Save errno earlier.
ClosedPublic

Authored by des on Sep 20 2024, 4:18 PM.
Tags
None
Referenced Files
F125537912: D46718.id143543.diff
Fri, Aug 8, 10:27 PM
Unknown Object (File)
Sat, Aug 2, 11:10 PM
Unknown Object (File)
Mon, Jul 21, 8:46 PM
Unknown Object (File)
Thu, Jul 17, 5:11 AM
Unknown Object (File)
Fri, Jul 11, 12:21 PM
Unknown Object (File)
Jul 9 2025, 4:19 AM
Unknown Object (File)
Jun 27 2025, 11:26 AM
Unknown Object (File)
Jun 25 2025, 3:55 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