aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2019-05-01 13:04:54 +0200
committerKarel Kočí <cynerd@email.cz>2019-05-01 13:04:54 +0200
commit7d7f197e679bd0cc21ef9086bc4b4fd4f635ccad (patch)
tree9809a913191cac826cd5e7a53ffb9c60327b6257
parentc4dc2c75b04719908954a3fc9fa622e0922d1b79 (diff)
downloaduroot-7d7f197e679bd0cc21ef9086bc4b4fd4f635ccad.tar.gz
uroot-7d7f197e679bd0cc21ef9086bc4b4fd4f635ccad.tar.bz2
uroot-7d7f197e679bd0cc21ef9086bc4b4fd4f635ccad.zip
child: fix single argument causing shell startup
There was an error where when we had only one argument that it would not run it as program but it would start shell instead. This fixes that.
-rw-r--r--child.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/child.c b/child.c
index d25df85..67eeeb2 100644
--- a/child.c
+++ b/child.c
@@ -49,12 +49,12 @@ int child_main(void *_args) {
assert_perror(errno);
}
- if (args->argc <= 1) {
- const char *shell = get_shell();
- execl(shell, shell, NULL);
- } else {
+ if (args->argc > 0) {
execvp(args->argv[0], args->argv);
assert_perror(errno);
+ } else {
+ const char *shell = get_shell();
+ execl(shell, shell, NULL);
}
return 1;
}