3 ms·
Sure, but just use execvp and it's a damn sight safer because you know exactly the state of your child's environment state. You can see this in the CERT C codin
by fao_ 5y ago
Sure, but just use execvp and it's a damn sight safer because you know exactly the state of your child's environment state. You can see this in the CERT C coding guidelines: https://wiki.sei.cmu.edu/confluence/display/c/ENV03-C.+Sanitize+the+environment+when+invoking+external+programs https://wiki.sei.cmu.edu/confluence/display/c/ENV03-C.+Sanit...
also ENV02-C comes into effect, as well, if your program is invoked with
SOME_INTERNAL_VARIABLE=1 PORT=2000 ./prog
then you try to invoke your child with:
setenv("SOME_INTERNAL_VARIABLE", "2", 1);
(fork blah blah)