Page MenuHomeFreeBSD

Save errno in `warn()` family of functions
ClosedPublic

Authored by otis on Oct 19 2020, 9:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 7, 1:41 AM
Unknown Object (File)
Fri, Oct 3, 10:43 PM
Unknown Object (File)
Fri, Sep 26, 9:29 PM
Unknown Object (File)
Sep 4 2025, 10:16 PM
Unknown Object (File)
Sep 3 2025, 3:23 PM
Unknown Object (File)
Aug 9 2025, 7:16 AM
Unknown Object (File)
Aug 2 2025, 12:26 PM
Unknown Object (File)
Aug 1 2025, 9:20 PM

Details

Summary

When warn() family of functions is being used after err_set_file() has been set to, for example, /dev/null, errno is being clobbered, rendering it unreliable after, for example, procstat_getpathname() when it is supposed to emit a warning. Then the errno is changed to Inappropriate ioctl for device, destroying the original value (via calls to fprintf()functions).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

otis requested review of this revision.Oct 19 2020, 9:17 PM

I was going to ask why you didn't do this for the err* functions too... Then realized it was probably time for me to knock off for the day if I had that question :)

This revision is now accepted and ready to land.Oct 19 2020, 11:28 PM
In D26871#599219, @imp wrote:

I was going to ask why you didn't do this for the err* functions too... Then realized it was probably time for me to knock off for the day if I had that question :)

This revision now requires review to proceed.Oct 20 2020, 7:43 AM
This revision is now accepted and ready to land.Oct 22 2020, 5:02 PM
This revision was automatically updated to reflect the committed changes.

Doh! missed the 'static' here. Removed in a followup commit.