diff options
author | Karel Kočí <cynerd@email.cz> | 2019-05-01 13:04:54 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2019-05-01 13:04:54 +0200 |
commit | 7d7f197e679bd0cc21ef9086bc4b4fd4f635ccad (patch) | |
tree | 9809a913191cac826cd5e7a53ffb9c60327b6257 | |
parent | c4dc2c75b04719908954a3fc9fa622e0922d1b79 (diff) | |
download | uroot-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.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; } |