From owner-freebsd-hackers@FreeBSD.ORG Sun Jan 2 10:38:38 2011 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66F77106566B for ; Sun, 2 Jan 2011 10:38:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id D14DC8FC16 for ; Sun, 2 Jan 2011 10:38:35 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p02AK3lW009200 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 2 Jan 2011 12:20:03 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p02AK3u7093280; Sun, 2 Jan 2011 12:20:03 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p02AK39l093279; Sun, 2 Jan 2011 12:20:03 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 2 Jan 2011 12:20:03 +0200 From: Kostik Belousov To: Eitan Adler Message-ID: <20110102102003.GD90883@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GpIToxGFjxEkdZJB" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: hackers@freebsd.org Subject: Re: [patch] rtprio/idprio should use basename(3) instead of acting on its own X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Jan 2011 10:38:38 -0000 --GpIToxGFjxEkdZJB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 02, 2011 at 02:18:55AM -0500, Eitan Adler wrote: > Index: rtprio.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- rtprio.c (revision 216884) > +++ rtprio.c (working copy) > @@ -41,6 +41,7 @@ >=20 > #include > #include > +#include > #include > #include > #include > @@ -57,11 +58,7 @@ > int proc =3D 0; > struct rtprio rtp; >=20 > - /* find basename */ > - if ((p =3D rindex(argv[0], '/')) =3D=3D NULL) > - p =3D argv[0]; > - else > - ++p; > + p =3D basename(argv[0]); >=20 > if (!strcmp(p, "rtprio")) > rtp.type =3D RTP_PRIO_REALTIME; >=20 basename(3) does much more work that IMO not needed there. rindex() use is a well-known pattern that is common for almost all utilities that check the calling name. I do not think it is worth the churn. --GpIToxGFjxEkdZJB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk0gUVIACgkQC3+MBN1Mb4jJWwCgkP18+ttTxJfLXewB4QCrRWHy G2QAn1f1pKPHpSIUQpKv4JUUo9MIojcN =a9kw -----END PGP SIGNATURE----- --GpIToxGFjxEkdZJB--