Compare commits

..

No commits in common. "34b099fc3309f5a161a33a72c1ca87e8a96dfe6b" and "7ed3ffc7ea4000096e7253fdb741f55903fd14b3" have entirely different histories.

2 changed files with 2 additions and 5 deletions

View file

@ -15,7 +15,7 @@ build/child: build
.PHONY: test .PHONY: test
test: all test: all
@echo "==> Testing execve with &NULL..." @echo "==> Testing execve with { NULL }..."
./build/parent-ptr ./build/child ./build/parent-ptr ./build/child
@echo "==> Testing execve with NULL..." @echo "==> Testing execve with NULL..."
./build/parent-null ./build/child ./build/parent-null ./build/child

View file

@ -1,11 +1,9 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
int int
main(int argc, char **argv, char **envp) main(int argc, char **argv, char **envp)
{ {
int ret = 0;
char *arr = NULL; char *arr = NULL;
char **ptr = char **ptr =
#ifdef PTR_TO_NULL #ifdef PTR_TO_NULL
@ -16,8 +14,7 @@ main(int argc, char **argv, char **envp)
printf("%s: using just NULL as argv...\n", argv[0]); printf("%s: using just NULL as argv...\n", argv[0]);
#endif #endif
printf("%s: argv == %p\n", argv[0], ptr); printf("%s: argv == %p\n", argv[0], ptr);
ret = execve(argv[1], ptr, envp); execve(argv[1], ptr, envp);
printf("%s: execve failed ;_; got %s\n", argv[0], strerror(ret));
return 0; return 0;
} }