pexec

execute a program from standard input
git clone git://git.2f30.org/pexec
Log | Files | Refs

commit e17d95c405ee16356bc140c0553f4dc687a8bfc4
parent 599ecdb2636f77f0f13135adadece6c3778081ea
Author: sin <sin@2f30.org>
Date:   Fri, 23 Mar 2018 11:33:30 +0000

Fixup argument passing

It is the caller's responsibility to pass the right arguments.
pexec() shouldn't have to know.

Diffstat:
Mpexec.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pexec.c b/pexec.c @@ -79,7 +79,6 @@ pexec(int fd, int argc, char *argv[]) { extern char **environ; - argc--, argv++; if (fexecve(fd, argv, environ) < 0) err(1, "fexecve"); } @@ -108,6 +107,7 @@ main(int argc, char *argv[]) while ((n = xread(STDIN_FILENO, buf, BUFSIZ)) > 0) xwrite(fd, buf, n); + argc--, argv++; pexec(fd, argc, argv); /* unreachable */ }