summaryrefslogtreecommitdiff
path: root/exec/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'exec/exec.c')
-rw-r--r--exec/exec.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/exec/exec.c b/exec/exec.c
index f3ee85e..c32c637 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -1,6 +1,7 @@
-#define _POSIX_SOURCE
+#define _POSIX_C_SOURCE 200809L
#include <errno.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#define NOT_RUN (126)
@@ -13,8 +14,8 @@ int main(int argc, char *argv[])
return NOT_RUN;
}
- execv(argv[1], argv + 1);
- perror(argv[0]);
+ execvp(argv[1], argv + 1);
+ fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(errno));
if (errno == ENOENT) {
return NOT_FOUND;
}