In a message written on Mon, Jul 21, 2003 at 08:53:53AM -0700, Tim Kientzle wrote:
> Actually, this example passes -Wall if you declare
> "execargv" as simply "char *[]".  However, I'm looking
> for something that passes gcc -Wwrite-strings, which this
> example does not.

% cat exec.c

#include <unistd.h>
#include <paths.h>

int main(int argc, char *const argv[], char *const envp[]) {
  char *execargv[2];

  execargv[0] = (char *)_PATH_BSHELL;
  execargv[1] = (char *)NULL;

  execve(_PATH_BSHELL,execargv,envp);

  return 0;
}
% cc -Wwrite-strings exec.c
% cc -Wall exec.c

Looks good to me.

-- 
       Leo Bicknell - [EMAIL PROTECTED] - CCIE 3440
        PGP keys at http://www.ufp.org/~bicknell/
Read TMBG List - [EMAIL PROTECTED], www.tmbg.org

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to