General Unix/C question

John Blair john at tcom.stc.co.uk
Sat Sep 3 00:23:00 AEST 1988


Below is the program I use to run a unix command under the userid of the
program owner.
However when the command passed is Make with parameters and 
stdout and stderr file redirection I sometimes get segmentation
problems and core dumped.

If I "su" as the userid of the program owner
and execute the same Make command I do not get segmentation problems.
What is wrong with the C program?

/* note, this must run with set uid on execution */
main(argc,argv)
 int argc;
 char * argv[];
{
 setuid(geteuid());
 setgid(getegid());
 execvp(argv[1],argv+1);
}



More information about the Comp.unix.questions mailing list