mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-03-15 03:16:51 +01:00
「🔨」 fix: fixed error when infile alone
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/04 15:00:32 by adjoly #+# #+# */
|
||||
/* Updated: 2024/07/21 17:44:29 by mmoussou ### ########.fr */
|
||||
/* Updated: 2024/08/01 17:39:20 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,6 +17,8 @@ t_cmd *split_cmd(char *cmd_av, t_cmd *cmd)
|
||||
{
|
||||
char **split;
|
||||
|
||||
cmd->argv = NULL;
|
||||
cmd->cmd = NULL;
|
||||
split = split_argv(cmd_av);
|
||||
if (!split)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/04 20:10:35 by adjoly #+# #+# */
|
||||
/* Updated: 2024/07/10 01:19:32 by adjoly ### ########.fr */
|
||||
/* Updated: 2024/08/01 17:40:10 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -37,12 +37,14 @@ void free_cmd(void *content)
|
||||
t_cmd *cmd;
|
||||
|
||||
cmd = (t_cmd *)content;
|
||||
if (cmd->cmd)
|
||||
free(cmd->cmd);
|
||||
if (!cmd)
|
||||
return ;
|
||||
if (cmd->infile != STDIN_FILENO && cmd->infile != -1)
|
||||
close(cmd->infile);
|
||||
if (cmd->outfile != STDOUT_FILENO && cmd->outfile != -1)
|
||||
close(cmd->outfile);
|
||||
if (cmd->cmd)
|
||||
free(cmd->cmd);
|
||||
if (cmd->argv)
|
||||
ft_free("a", &(cmd->argv));
|
||||
if (cmd)
|
||||
|
Reference in New Issue
Block a user