diff options
author | Ed Schouten <ed@FreeBSD.org> | 2016-05-19 20:03:01 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2016-05-19 20:03:01 +0000 |
commit | c76f604ee9460d3a52e34e5f7219c57fc2c27133 (patch) | |
tree | d79528545a62cbb6c223392d3cde3b0aea456d38 /usr.bin/ar | |
parent | 18849b5da0c5eaa88500b457be05b038813b51b1 (diff) | |
download | src-test2-c76f604ee9460d3a52e34e5f7219c57fc2c27133.tar.gz src-test2-c76f604ee9460d3a52e34e5f7219c57fc2c27133.zip |
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
Notes
Notes:
svn path=/head/; revision=300227
Diffstat (limited to 'usr.bin/ar')
-rw-r--r-- | usr.bin/ar/ar.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ar/ar.c b/usr.bin/ar/ar.c index 0c6931521ab4..b93c968501c2 100644 --- a/usr.bin/ar/ar.c +++ b/usr.bin/ar/ar.c @@ -272,10 +272,10 @@ main(int argc, char **argv) "only one of -s and -S options allowed"); if (bsdar->options & (AR_A | AR_B)) { - if ((bsdar->posarg = *argv) == NULL) + if (*argv == NULL) bsdar_errc(bsdar, EX_USAGE, 0, "no position operand specified"); - if ((bsdar->posarg = basename(bsdar->posarg)) == NULL) + if ((bsdar->posarg = basename(*argv)) == NULL) bsdar_errc(bsdar, EX_SOFTWARE, errno, "basename failed"); argc--; |