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, Oct 8, 10:44 AM
Unknown Object (File)
Tue, Oct 7, 1:55 AM
Unknown Object (File)
Sun, Sep 21, 12:47 PM
Unknown Object (File)
Sep 11 2025, 7:20 AM
Unknown Object (File)
Sep 3 2025, 7:10 PM
Unknown Object (File)
Aug 14 2025, 12:01 PM
Unknown Object (File)
Aug 8 2025, 10:27 PM
Unknown Object (File)
Aug 2 2025, 11:10 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