From owner-freebsd-hackers@FreeBSD.ORG Sun Jan 2 07:19:16 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 F37AA106566C for ; Sun, 2 Jan 2011 07:19:16 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id CB9A78FC13 for ; Sun, 2 Jan 2011 07:19:16 +0000 (UTC) Received: by iyb26 with SMTP id 26so11825356iyb.13 for ; Sat, 01 Jan 2011 23:19:16 -0800 (PST) Received: by 10.231.16.131 with SMTP id o3mr3258963iba.5.1293952756108; Sat, 01 Jan 2011 23:19:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.178.195 with HTTP; Sat, 1 Jan 2011 23:18:55 -0800 (PST) From: Eitan Adler Date: Sun, 2 Jan 2011 02:18:55 -0500 Message-ID: To: hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 Cc: Subject: [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 07:19:17 -0000 Index: rtprio.c =================================================================== --- rtprio.c (revision 216884) +++ rtprio.c (working copy) @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -57,11 +58,7 @@ int proc = 0; struct rtprio rtp; - /* find basename */ - if ((p = rindex(argv[0], '/')) == NULL) - p = argv[0]; - else - ++p; + p = basename(argv[0]); if (!strcmp(p, "rtprio")) rtp.type = RTP_PRIO_REALTIME; -- Eitan Adler