Page MenuHomeFreeBSD

Remove useless calls to basename().
ClosedPublic

Authored by ed on Apr 25 2016, 8:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 7:55 PM
Unknown Object (File)
Sat, Apr 20, 7:54 PM
Unknown Object (File)
Apr 14 2024, 5:52 AM
Unknown Object (File)
Mar 22 2024, 10:08 PM
Unknown Object (File)
Mar 22 2024, 10:08 PM
Unknown Object (File)
Mar 22 2024, 10:08 PM
Unknown Object (File)
Mar 8 2024, 11:24 AM
Unknown Object (File)
Jan 29 2024, 5:40 PM
Subscribers

Details

Summary

There are a couple of places in the source three where we call
basename() on constant strings. This is bad, because the prototype
standardized by POSIX allows the implementation to use its argument as a
storage buffer.

This change eliminates some of these unportable calls to basename() in
cases where it was only added for cosmetical reasons, namely to trim
argv[0]. There's nothing wrong with setting argv[0] to the full path.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ed retitled this revision from to Remove useless calls to basename()..
ed updated this object.
ed edited the test plan for this revision. (Show Details)
ed added reviewers: jilles, pjd.
jilles edited edge metadata.

This may lead to somewhat ugly messages like

-/bin/sh: Syntax error: ")" unexpected

for newgrp -l (where -sh: used to appear) but I think newgrp is not used often enough to warrant making this more complicated.

This revision is now accepted and ready to land.Apr 30 2016, 1:51 PM
This revision was automatically updated to reflect the committed changes.