Make code compile when basename() is POSIX compliant.
If basename() uses "char *", we shouldn't do the intermediate assignment, as that field is of type "const char *". Simply call basename() on the command line argument directly. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D6463
This commit is contained in:
parent
18849b5da0
commit
c76f604ee9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300227
@ -272,10 +272,10 @@ main(int argc, char **argv)
|
|||||||
"only one of -s and -S options allowed");
|
"only one of -s and -S options allowed");
|
||||||
|
|
||||||
if (bsdar->options & (AR_A | AR_B)) {
|
if (bsdar->options & (AR_A | AR_B)) {
|
||||||
if ((bsdar->posarg = *argv) == NULL)
|
if (*argv == NULL)
|
||||||
bsdar_errc(bsdar, EX_USAGE, 0,
|
bsdar_errc(bsdar, EX_USAGE, 0,
|
||||||
"no position operand specified");
|
"no position operand specified");
|
||||||
if ((bsdar->posarg = basename(bsdar->posarg)) == NULL)
|
if ((bsdar->posarg = basename(*argv)) == NULL)
|
||||||
bsdar_errc(bsdar, EX_SOFTWARE, errno,
|
bsdar_errc(bsdar, EX_SOFTWARE, errno,
|
||||||
"basename failed");
|
"basename failed");
|
||||||
argc--;
|
argc--;
|
||||||
|
Loading…
Reference in New Issue
Block a user