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, Sep 29, 8:09 PM
Unknown Object (File)
Fri, Sep 25, 8:32 PM
Unknown Object (File)
Fri, Sep 25, 8:08 PM
Unknown Object (File)
Fri, Sep 25, 5:49 PM
Unknown Object (File)
Tue, Sep 22, 11:29 PM
Unknown Object (File)
Sep 10 2026, 3:10 PM
Unknown Object (File)
Sep 10 2026, 3:07 PM
Unknown Object (File)
Sep 5 2026, 3:40 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.