Date: Sun, 20 Jul 2003 18:50:41 -0400 From: Leo Bicknell <bicknell@ufp.org> To: hackers@freebsd.org Subject: Re: Correct way to call execve? Message-ID: <20030720225041.GA26277@ussenterprise.ufp.org> In-Reply-To: <3F1B0610.90803@acm.org> References: <3F1B0610.90803@acm.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
In a message written on Sun, Jul 20, 2003 at 02:13:52PM -0700, Tim Kientzle wrote:
> If I declare argv as "const char *",
> then the call to execve() warns about
> "incompatible pointer type" for the
> second argument.
Almost, but the other order is important here, this passes gcc -Wall:
#include <unistd.h>
#include <paths.h>
int main(int argc, char *const argv[], char *const envp[]) {
char *const execargv[] = { _PATH_BSHELL, NULL };
execve(_PATH_BSHELL,execargv,envp);
return 0;
}
--
Leo Bicknell - bicknell@ufp.org - CCIE 3440
PGP keys at http://www.ufp.org/~bicknell/
Read TMBG List - tmbg-list-request@tmbg.org, www.tmbg.org
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)
iD8DBQE/GxzBNh6mMG5yMTYRAkQCAJoDyjQr2QDxYPCdWNSORhHRBatDIgCfT5v5
FdkH53v4u5HDkGvOVBVU6Ss=
=UjGZ
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030720225041.GA26277>
