Date: Sun, 20 Jul 2003 14:13:52 -0700 From: Tim Kientzle <kientzle@acm.org> To: hackers@freebsd.org Subject: Correct way to call execve? Message-ID: <3F1B0610.90803@acm.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F1B0610.90803>