Re: Correct way to call execve?

[ Available lists | Index of freebsd-hackers | Month of Jul 2003 | Week of 21 Jul 2003 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Leo Bicknell <bicknell@ufp.org>
Date
21 Jul 2003 10:23:24
Subject
Re: Correct way to call execve?
Message-ID
20030721172321.GA57666@ussenterprise.ufp.org

In reply to
Replies

[ Hide this part ]
In a message written on Mon, Jul 21, 2003 at 11:15:38AM -0600, Chad David wrote:
> Try cc -Wwrite-strings -Wcast-qual exec.c.
>
> You cannot simply cast away a const.

Grumble, will someone give me all the warnings you want turned on so I
can work around all of them? :)

% cat exec.c

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

int main(int argc, char *const argv[], char *const envp[]) {
char *const execargv[] = { strdup(_PATH_BSHELL), strdup(NULL) };

execve(_PATH_BSHELL,execargv,envp);

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

--
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


[ Show this part (application/pgp-signature) ]

Elapsed time: 0.157 seconds