commit 9499528b65fa47723e8392cf8c320ff6cdd96723
parent bfc7549b18b1619ccdcdfb7e0fc684338f1e1ccf
Author: sin <sin@2f30.org>
Date: Fri, 23 Mar 2018 11:48:15 +0000
Add an envp argument to pexec()
Diffstat:
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/pexec.c b/pexec.c
@@ -75,11 +75,9 @@ xwrite(int fd, const void *buf, size_t nbytes)
}
static void
-pexec(int fd, int argc, char *argv[])
+pexec(int fd, int argc, char *argv[], char *envp[])
{
- extern char **environ;
-
- if (fexecve(fd, argv, environ) < 0)
+ if (fexecve(fd, argv, envp) < 0)
err(1, "fexecve");
}
@@ -108,6 +106,7 @@ main(int argc, char *argv[])
xwrite(fd, buf, n);
argc--, argv++;
- pexec(fd, argc, argv);
+ extern char **environ;
+ pexec(fd, argc, argv, environ);
/* unreachable */
}