Page MenuHomeFreeBSD

lpd: Fix issues reported by clang-analyzer
ClosedPublic

Authored by des on May 22 2026, 8:28 PM.
Tags
None
Referenced Files
F166146492: D57185.id.diff
Tue, Aug 11, 11:33 PM
F166144462: D57185.id178567.diff
Tue, Aug 11, 11:28 PM
F166142283: D57185.id178433.diff
Tue, Aug 11, 11:24 PM
F166100593: D57185.id178433.diff
Tue, Aug 11, 5:44 PM
Unknown Object (File)
Mon, Aug 10, 12:22 PM
Unknown Object (File)
Mon, Aug 10, 7:40 AM
Unknown Object (File)
Sun, Aug 9, 3:53 PM
Unknown Object (File)
Sun, Aug 9, 2:59 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.