aboutsummaryrefslogtreecommitdiff
path: root/lib/xwrap.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2020-05-03 23:15:35 -0500
committerRob Landley <rob@landley.net>2020-05-03 23:15:35 -0500
commite9396994d328606ff436b87bea3a0321bba98809 (patch)
tree497cc2fbda98a124d9dc9dd836d80d5b92028702 /lib/xwrap.c
parentb0ed57b1aad9d2a0cfb64999cc1e0bc15471a48c (diff)
downloadtoybox-e9396994d328606ff436b87bea3a0321bba98809.tar.gz
Next round of shell work.
Diffstat (limited to 'lib/xwrap.c')
-rw-r--r--lib/xwrap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index 5f18f295..b4a52c9e 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -224,7 +224,7 @@ void xexec(char **argv)
// If -1, replace with pipe handle connected to stdin/stdout.
// NULL treated as {0, 1}, I.E. leave stdin/stdout as is
// return: pid of child process
-pid_t xpopen_setup(char **argv, int *pipes, void (*callback)(void))
+pid_t xpopen_setup(char **argv, int *pipes, void (*callback)(char **argv))
{
int cestnepasun[4], pid;
@@ -269,7 +269,7 @@ pid_t xpopen_setup(char **argv, int *pipes, void (*callback)(void))
close(pipes[1]);
}
}
- if (callback) callback();
+ if (callback) callback(argv);
if (argv) xexec(argv);
// In fork() case, force recursion because we know it's us.
@@ -287,6 +287,7 @@ pid_t xpopen_setup(char **argv, int *pipes, void (*callback)(void))
// setting high bit of argv[0][0] to let new process know
**toys.argv |= 0x80;
execv(s, toys.argv);
+ if ((s = getenv("_"))) execv(s, toys.argv);
perror_msg_raw(s);
_exit(127);