Page MenuHomeFreeBSD

Fix a file descriptor leak in cmp(1)
ClosedPublic

Authored by asomers on Jan 6 2017, 10:41 PM.

Details

Summary

Fix a file descriptor leak in cmp(1)

Also, add a few test cases

Reported by: Coverity
CID: 271624

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

asomers retitled this revision from to Fix a file descriptor leak in cmp(1).Jan 6 2017, 10:41 PM
asomers updated this object.
asomers edited the test plan for this revision. (Show Details)
asomers added a reviewer: ngie.
asomers updated this revision to Diff 23683.
ngie added inline comments.Jan 6 2017, 11:04 PM
contrib/netbsd-tests/usr.bin/cmp/t_cmp.sh
63–98 ↗(On Diff #23683)

Please add # Begin FreeBSD and # End FreeBSD to denote the changes we added.

93 ↗(On Diff #23683)

-e ignore -x for consistency?

usr.bin/cmp/special.c
102 ↗(On Diff #23683)

What about fp2?

asomers added inline comments.Jan 6 2017, 11:17 PM
contrib/netbsd-tests/usr.bin/cmp/t_cmp.sh
63–98 ↗(On Diff #23683)

I can do that, or I can create a separate test file for our tests. Which would you prefer?

93 ↗(On Diff #23683)

Ok.

usr.bin/cmp/special.c
102 ↗(On Diff #23683)

Grr, I should've seen that. Still, I wish Coverity would sanely sort its output.

ngie added inline comments.Jan 6 2017, 11:24 PM
contrib/netbsd-tests/usr.bin/cmp/t_cmp.sh
63–98 ↗(On Diff #23683)

I think this makes sense. It might be a good idea to push this back to NetBSD..

asomers updated this revision to Diff 23686.Jan 7 2017, 12:11 AM

Incorporate ngie's feedback

ngie edited edge metadata.Jan 7 2017, 12:37 AM
ngie accepted this revision.
ngie added inline comments.
usr.bin/cmp/tests/Makefile
5–6 ↗(On Diff #23686)

Please...

  • use += to ensure that the value of ${ATF_TESTS_SH}
  • put ATF_TESTS_SH+= above NETBSD_ATF_TESTS_SH for sorting purposes.
This revision is now accepted and ready to land.Jan 7 2017, 12:37 AM
This revision was automatically updated to reflect the committed changes.