Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 May 2016 20:03:01 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300227 - head/usr.bin/ar
Message-ID:  <201605192003.u4JK31MN090555@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Thu May 19 20:03:01 2016
New Revision: 300227
URL: https://svnweb.freebsd.org/changeset/base/300227

Log:
  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

Modified:
  head/usr.bin/ar/ar.c

Modified: head/usr.bin/ar/ar.c
==============================================================================
--- head/usr.bin/ar/ar.c	Thu May 19 19:51:39 2016	(r300226)
+++ head/usr.bin/ar/ar.c	Thu May 19 20:03:01 2016	(r300227)
@@ -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--;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605192003.u4JK31MN090555>