From 7d7f197e679bd0cc21ef9086bc4b4fd4f635ccad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Wed, 1 May 2019 13:04:54 +0200 Subject: 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. --- child.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'child.c') 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; } -- cgit v1.2.3