Page MenuHomeFreeBSD

cp: Minor code cleanup.
ClosedPublic

Authored by des on Feb 3 2023, 11:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 10, 10:16 AM
Unknown Object (File)
Mon, Oct 6, 9:23 AM
Unknown Object (File)
Thu, Oct 2, 4:29 AM
Unknown Object (File)
Tue, Sep 30, 4:12 AM
Unknown Object (File)
Mon, Sep 22, 3:15 AM
Unknown Object (File)
Fri, Sep 19, 11:35 PM
Unknown Object (File)
Wed, Sep 17, 6:00 AM
Unknown Object (File)
Aug 26 2025, 11:22 PM

Details

Reviewers
allanjude
Group Reviewers
Klara
Commits
rGcb96a0ef0040: cp: Minor code cleanup.
Summary
  • Fix includes in utils.c, cf. style(9).
  • Fix type mismatch: readlink(2) returns ssize_t, not int.
  • It is not necessary to set errno to 0 as fts_read(3) already does it.

MFC after: 1 week

Sponsored by: Klara, Inc.

Diff Detail

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

Event Timeline

des requested review of this revision.Feb 3 2023, 11:32 AM
des retitled this revision from cp: Clean up includes. to cp: Minor code cleanup..Feb 3 2023, 12:12 PM
allanjude added a subscriber: allanjude.

Reviewed by: allanjude

This revision is now accepted and ready to land.Feb 3 2023, 1:49 PM
This revision was automatically updated to reflect the committed changes.
bdrewery added inline comments.
bin/cp/cp.c
314

Has the issue noted in 73a0af46b854be94a05fcc4d4603619a00ac5707 and 2dfa4b66b3d0caaaae6ce2df476b5615f8415a19 been fixed in fts_read(3)? I don't see any changes to it to indicate it was fixed.

bin/cp/cp.c
314

Contrary to what those commits claim, fts_read() does set errno to 0 on successful EOF and always has. The only case in which it leaves errno unchanged is if it's called again after having already returned NULL, which we don't do here.