mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
fix(parsing/redirect): sometimes do not take a redirection into account
debug notes: ++++++++++++++++++++++++++++++++++++++++++++++++++++ failed: ambiguous redirect ++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++ test input: export target="outfile1 outfile2" echo hello > $target echo $? echo hi >> $target echo $? cat < $target echo $? ls echo $? ++++ Got output: hello 0 hi 0 echo $? ls echo $? ++++ But expected: minishell: $target: ambiguous redirect 1 minishell: $target: ambiguous redirect 1 minishell: $target: ambiguous redirect 1 0 Reproduced this with rr record --cahos, see /home/khais/.local/share/rr/minishell-48 $ export target="outfile1 outfile2" $ echo hi > $target hi Break in simple_cmd_execute, second command has no redirections when it should have some, presumably this comes from some uninitialized memory somewhere.
This commit is contained in:
parent
8d60113351
commit
3f08189aae
2 changed files with 4 additions and 4 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/14 17:31:35 by khais #+# #+# */
|
||||
/* Updated: 2025/04/17 11:44:45 by khais ### ########.fr */
|
||||
/* Updated: 2025/04/24 13:23:44 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -78,12 +78,13 @@ t_redirect *redir_from_words(t_worddesc *operator,
|
|||
redir->redirectee.dest = here_doc(specifier, STDIN_FILENO, app);
|
||||
worddesc_destroy(specifier);
|
||||
if (redir->redirectee.dest < 0)
|
||||
{
|
||||
ft_errno(FT_EERRNO);
|
||||
return (worddesc_destroy(operator), redirect_destroy(redir), NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
redir->redirectee.filename = specifier;
|
||||
worddesc_destroy(operator);
|
||||
if (redir->redirectee.dest < 0)
|
||||
return (redirect_destroy(redir), NULL);
|
||||
return (redir);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue