Compare commits
2 commits
7ed3ffc7ea
...
34b099fc33
Author | SHA1 | Date | |
---|---|---|---|
snow flurry | 34b099fc33 | ||
snow flurry | c9151e7772 |
2
Makefile
2
Makefile
|
@ -15,7 +15,7 @@ build/child: build
|
|||
|
||||
.PHONY: test
|
||||
test: all
|
||||
@echo "==> Testing execve with { NULL }..."
|
||||
@echo "==> Testing execve with &NULL..."
|
||||
./build/parent-ptr ./build/child
|
||||
@echo "==> Testing execve with NULL..."
|
||||
./build/parent-null ./build/child
|
||||
|
|
|
@ -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