From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 20 14:10:47 2003 Return-Path: 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 B96D537B401 for ; Sun, 20 Jul 2003 14:10:47 -0700 (PDT) Received: from kientzle.com (h-66-166-149-50.SNVACAID.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 09CC743F75 for ; Sun, 20 Jul 2003 14:10:47 -0700 (PDT) (envelope-from kientzle@acm.org) Received: from acm.org ([66.166.149.53]) by kientzle.com (8.12.9/8.12.9) with ESMTP id h6KLAksE017548 for ; Sun, 20 Jul 2003 14:10:46 -0700 (PDT) (envelope-from kientzle@acm.org) Message-ID: <3F1B0610.90803@acm.org> Date: Sun, 20 Jul 2003 14:13:52 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0.1) Gecko/20021005 X-Accept-Language: en-us, en MIME-Version: 1.0 To: hackers@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Correct way to call execve? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: kientzle@acm.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Jul 2003 21:10:48 -0000 I can find no way to call execve that actually compiles without warnings. If I use: char *argv[2]; argv[0] = _PATH_BSHELL; argv[1] = NULL; execve(_PATH_BSHELL,argv,environ); then the first assignment is "discarding qualifiers". If I declare argv as "const char *", then the call to execve() warns about "incompatible pointer type" for the second argument. Reading through SUSv3 I find that the committee thought that the second argument to execve() should have been "const char * const *", but they didn't want old code to generate compiler warnings. (Of course, compilers that correctly type constant strings as "const char *" break that.) Does anyone know a good way out of this mess? (Suggestions to turn off compiler warnings will be ignored. ;-) Tim Kientzle