Page MenuHomeFreeBSD

lpd: Fix issues reported by clang-analyzer
ClosedPublic

Authored by des on May 22 2026, 8:28 PM.
Tags
None
Referenced Files
F171898286: D57185.id178567.diff
Mon, Sep 14, 10:40 AM
Unknown Object (File)
Mon, Sep 14, 5:01 AM
Unknown Object (File)
Mon, Sep 14, 4:59 AM
Unknown Object (File)
Sat, Sep 12, 3:12 PM
Unknown Object (File)
Sat, Sep 12, 1:29 PM
Unknown Object (File)
Fri, Sep 11, 11:22 AM
Unknown Object (File)
Sun, Sep 6, 4:50 PM
Unknown Object (File)
Sun, Sep 6, 3:18 PM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

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
202–203

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
202–203

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.