From owner-freebsd-hackers Mon Mar 24 20:57:13 2003 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F404D37B404 for ; Mon, 24 Mar 2003 20:57:10 -0800 (PST) Received: from kientzle.com (h-66-166-149-50.SNVACAID.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id A81ED43FDD for ; Mon, 24 Mar 2003 20:57:08 -0800 (PST) (envelope-from kientzle@acm.org) Received: from acm.org (ugly.x.kientzle.com [66.166.149.51]) by kientzle.com (8.11.3/8.11.3) with ESMTP id h2P4v8M20501 for ; Mon, 24 Mar 2003 20:57:08 -0800 (PST) (envelope-from kientzle@acm.org) Message-ID: <3E7FE1C4.3040104@acm.org> Date: Mon, 24 Mar 2003 20:57:40 -0800 From: Tim Kientzle Reply-To: kientzle@acm.org User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.6) Gecko/20011206 X-Accept-Language: en-us, en MIME-Version: 1.0 To: FreeBSD-Hackers Subject: Incorrect declarations for exec* Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-5.8 required=5.0 tests=USER_AGENT_MOZILLA_UA autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I believe the exec* functions are declared incorrectly. Unless I'm mistaken, execve should be declared as int execve(const char *path, const char *const argv[], const char *const envp[]); rather than int execve(const char *path, char *const argv[], char *const envp[]); (Note the additional 'const' for argv and envp.) Without this, there's no completely correct way to build an argv or envp array with constant strings, since you end up discarding a const somewhere along the way. Similar edits should be done to the other exec* declarations. Yes, GCC complains either way, since it (erroneously) warns about adding const-ness in a pointer assignment. (But only if you routinely use '-pedantic', which I doubt many people do. ;-) Tim Kientzle To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message