Page MenuHomeFreeBSD

printf(): Save errno earlier.
ClosedPublic

Authored by des on Sep 20 2024, 4:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Dec 27, 6:46 PM
Unknown Object (File)
Nov 30 2025, 3:02 AM
Unknown Object (File)
Nov 16 2025, 10:48 PM
Unknown Object (File)
Nov 11 2025, 1:41 AM
Unknown Object (File)
Nov 10 2025, 4:49 PM
Unknown Object (File)
Nov 10 2025, 12:59 PM
Unknown Object (File)
Nov 10 2025, 8:45 AM
Unknown Object (File)
Nov 7 2025, 1:11 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 59541
Build 56428: arc lint + arc unit