From owner-svn-src-all@freebsd.org Mon Aug 10 21:40:32 2015 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 79B4499E639 for ; Mon, 10 Aug 2015 21:40:32 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BDD114D for ; Mon, 10 Aug 2015 21:40:32 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by oihn130 with SMTP id n130so95563149oih.2 for ; Mon, 10 Aug 2015 14:40:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=r66z6o6hYhoy9AuwhRT35kofItzDLJlwdL5Y0a+63hI=; b=NbwJnsI1sgDDdowY185Vb/EZDijqjt7sV1GOsbSAfoLprxFHkIO2+CxQNnLKB1QTHC JHQddrvH/as5dJ0FOj7SBLR+yGJZNQNUjNpU3tZKmG2X7zXB/3O3yR2Jmzc2/psHg390 wceea5y19iU1eAxJSK5zE0xTtVkk+9OAEBQEx/2uDepYmX8l0eS9gj9GVcM2blS9sEmO CJxfnJzu/Lnj0Hqjb8LCBnsLts2kjfmmeVIzrc7Cho9p59GlNeuBePe9xyGWLtmm+/lD MoTRrhpRP/vDs74OeyZi0AYjZb2rLsGqJUGRdfrazbQMoUSokpl5ps0f4J/MGsLFVS6F P4yQ== X-Gm-Message-State: ALoCoQnuU8+MqiywFCtdY7bKttBnJUzZP2ub4h1YvEZKtR6TrAAxcPeQhDgoPBrseLNv02Vm7POS MIME-Version: 1.0 X-Received: by 10.202.229.204 with SMTP id c195mr6301369oih.113.1439242825085; Mon, 10 Aug 2015 14:40:25 -0700 (PDT) Received: by 10.76.50.84 with HTTP; Mon, 10 Aug 2015 14:40:25 -0700 (PDT) X-Originating-IP: [84.27.222.46] In-Reply-To: <201508102131.t7ALVo5J050735@repo.freebsd.org> References: <201508102131.t7ALVo5J050735@repo.freebsd.org> Date: Mon, 10 Aug 2015 23:40:25 +0200 Message-ID: Subject: Re: svn commit: r286601 - head/usr.bin/patch From: Ed Schouten To: Xin LI Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 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: Mon, 10 Aug 2015 21:40:32 -0000 Hi Xin, 2015-08-10 23:31 GMT+02:00 Xin LI : > + argp[0] = strdup(RCSDIFF); > + argp[1] = strdup(filename); > ... > + free(argp[1]); > + free(argp[0]); > + argp[0] = strdup(CHECKOUT); > + argp[1] = strdup("-l"); > + argp[2] = strdup(filename); > ... > + free(argp[2]); > + free(argp[1]); > + free(argp[0]); There's no need to call strdup() here, right? As far as I know, execve() and posix_spawn() don't modify the arguments/environment. These functions should use "const char *const *" as its argument type, but that cannot be used, as it would cause compiler errors if "char **" is passed in. See the table close to the bottom of this article: http://pubs.opengroup.org/onlinepubs/9699919799/functions/execve.html -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717