From owner-svn-src-all@freebsd.org Thu May 19 20:03:02 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8AD4B421A9; Thu, 19 May 2016 20:03:02 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A646E1E15; Thu, 19 May 2016 20:03:02 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4JK314K090556; Thu, 19 May 2016 20:03:01 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4JK31MN090555; Thu, 19 May 2016 20:03:01 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201605192003.u4JK31MN090555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Thu, 19 May 2016 20:03:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r300227 - head/usr.bin/ar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 May 2016 20:03:03 -0000 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--;