parent: cry if execve returns
This commit is contained in:
parent
7ed3ffc7ea
commit
c9151e7772
|
@ -1,9 +1,11 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
int
|
||||
main(int argc, char **argv, char **envp)
|
||||
{
|
||||
int ret = 0;
|
||||
char *arr = NULL;
|
||||
char **ptr =
|
||||
#ifdef PTR_TO_NULL
|
||||
|
@ -14,7 +16,8 @@ main(int argc, char **argv, char **envp)
|
|||
printf("%s: using just NULL as argv...\n", argv[0]);
|
||||
#endif
|
||||
printf("%s: argv == %p\n", argv[0], ptr);
|
||||
execve(argv[1], ptr, envp);
|
||||
ret = execve(argv[1], ptr, envp);
|
||||
|
||||
printf("%s: execve failed ;_; got %s\n", argv[0], strerror(ret));
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue