added valid_command() rule (only "cmd_prefix")

+ skip exec if no cmd_name in a command
This commit is contained in:
LuckyLaszlo
2021-12-17 03:17:58 +01:00
parent 59f0b7603b
commit 36de7bf150
3 changed files with 21 additions and 5 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
/* Updated: 2021/12/11 05:24:07 by lperrey ### ########.fr */
/* Updated: 2021/12/16 15:55:36 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -73,7 +73,7 @@ static int pipeline_find_access(t_cmd *pipeline[], char *path[])
i = 0;
while (pipeline[i])
{
if (!pipeline[i]->error)
if (!pipeline[i]->error && pipeline[i]->argv[0])
{
if (!cmd_find_access(pipeline[i], path))
return (0);
@@ -91,7 +91,7 @@ static pid_t pipeline_exec(t_cmd *pipeline[], t_all *c)
i = 0;
while (pipeline[i])
{
if (!pipeline[i]->error)
if (!pipeline[i]->error && pipeline[i]->argv[0])
{
ret = cmd_exec_in_subshell(pipeline[i], c);
if (ret != EXIT_SUCCESS)