From owner-freebsd-audit Wed Aug 8 12:51:46 2001 Delivered-To: freebsd-audit@freebsd.org Received: from arb.arb.za.net (www.tarmactroopers.co.za [196.7.148.4]) by hub.freebsd.org (Postfix) with ESMTP id 633FB37B433 for ; Wed, 8 Aug 2001 12:51:33 -0700 (PDT) (envelope-from mark@grondar.za) Received: (from uucp@localhost) by arb.arb.za.net (8.11.3/8.11.3) with UUCP id f78JpGQ59083; Wed, 8 Aug 2001 21:51:16 +0200 (SAST) (envelope-from mark@grondar.za) Received: from grondar.za (localhost [127.0.0.1]) by grimreaper.grondar.za (8.11.5/8.11.4) with ESMTP id f78CeNf03323; Wed, 8 Aug 2001 13:40:23 +0100 (BST) (envelope-from mark@grondar.za) Message-Id: <200108081240.f78CeNf03323@grimreaper.grondar.za> To: Bruce Evans Cc: audit@FreeBSD.ORG Subject: Re: [patch] su(1) WARNS=2 cleanup References: <20010808165645.W5697-100000@besplex.bde.org> In-Reply-To: <20010808165645.W5697-100000@besplex.bde.org> ; from Bruce Evans "Wed, 08 Aug 2001 17:21:33 +1000." Date: Wed, 08 Aug 2001 13:40:23 +0100 From: Mark Murray Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > - execv(shell, np); > > + execv(shell, (char * const *)np); > > Style bug: bogus cast. execve(2)'s second parameter has type > "char * const *". Conversion of np's type "(char **)" is automatic in C. I'm having a problem unravelling this. With np declared as "const char **", the other (bogus) casts can be removed, but gcc whines about execv(2): cc -O -pipe -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Werror -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -c /usr/src/usr.bin/su/su.c cc1: warnings being treated as errors /usr/src/usr.bin/su/su.c: In function `main': /usr/src/usr.bin/su/su.c:395: warning: passing arg 2 of `execv' from incompatible pointer type *** Error code 1 If I try to cast arg 2 like: execv(shell, (const char * const *)np); I get from gcc: cc -O -pipe -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Werror -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -c /usr/src/usr.bin/su/su.c cc1: warnings being treated as errors /usr/src/usr.bin/su/su.c: In function `main': /usr/src/usr.bin/su/su.c:395: warning: passing arg 2 of `execv' from incompatible pointer type *** Error code 1 Playing with "const" in various parts of the const ony ever gets one of the above warning/errors. Hints? GCC bug? M -- Mark Murray Warning: this .sig is umop ap!sdn To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message