Page MenuHomeFreeBSD

lpd: Fix issues reported by clang-analyzer
ClosedPublic

Authored by des on May 22 2026, 8:28 PM.
Tags
None
Referenced Files
F170797349: D57185.id178567.diff
Sun, Sep 6, 4:50 PM
F170786760: D57185.id178567.diff
Sun, Sep 6, 3:18 PM
Unknown Object (File)
Sun, Sep 6, 3:04 AM
Unknown Object (File)
Sat, Sep 5, 6:40 PM
Unknown Object (File)
Sat, Sep 5, 6:40 PM
Unknown Object (File)
Sat, Sep 5, 6:21 PM
Unknown Object (File)
Sat, Sep 5, 2:26 PM
Unknown Object (File)
Sat, Sep 5, 1:35 PM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 73355
Build 70238: arc lint + arc unit

Event Timeline

des requested review of this revision.May 22 2026, 8:28 PM
markj added inline comments.
usr.sbin/lpr/lpd/printjob.c
208

The first sentence isn't necessarily true. I don't think it matters much though.

This revision is now accepted and ready to land.May 25 2026, 12:58 PM
usr.sbin/lpr/lpd/printjob.c
208

Barring a race condition, I think it's pretty much the only way we can get to this point with a non-zero statok, isn't it? Although perhaps we should make the fstat() unconditional and error out if it fails; just moving it into the condition for the if above should do the trick.

usr.sbin/lpr/lpd/printjob.c
208

Yes, I was thinking of a race condition. I think checking after open() would be simpler.

This revision now requires review to proceed.May 25 2026, 2:35 PM
This revision is now accepted and ready to land.May 25 2026, 2:41 PM
des marked 2 inline comments as done.May 25 2026, 5:02 PM
This revision was automatically updated to reflect the committed changes.