Merge branch 'master' of github.com:kinou-p/Minishell

This commit is contained in:
PrStein 2022-04-20 16:00:07 +02:00
commit 64b25ac82e
3 changed files with 10 additions and 9 deletions

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/08 15:19:42 by apommier #+# #+# */
/* Updated: 2022/04/20 14:30:49 by apommier ### ########.fr */
/* Updated: 2022/04/20 15:49:33 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -27,7 +27,7 @@ t_s_cmd *set_s_cmd(char *line, int index)
s_cmd->args = 0;
s_cmd->infile = 0;
s_cmd->outfile = 0;
line = set_redirection(s_cmd, line, index, 0);
line = set_redirection(s_cmd, ft_strdup(line), index, 0);
if (!line)
{
free(s_cmd);
@ -36,7 +36,7 @@ t_s_cmd *set_s_cmd(char *line, int index)
split_line = ft_split_with_quote(line, ' ');
s_cmd->nb_args = double_size(split_line);
s_cmd->args = split_line;
//free(line);
free(line);
return (s_cmd);
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/09 15:18:58 by apommier #+# #+# */
/* Updated: 2022/04/20 13:52:56 by apommier ### ########.fr */
/* Updated: 2022/04/20 15:22:35 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -35,9 +35,9 @@ int set_file(char *file, int type)
int fd;
if (type)
fd = open(file, O_APPEND | O_CREAT, 0644);
fd = open(file, O_APPEND | O_CREAT, 0666);
else
fd = open(file, O_TRUNC | O_CREAT, 0644);
fd = open(file, O_TRUNC | O_CREAT, 0666);
if (fd == -1)
{
ft_putstr_fd("Minishell: ", 2);

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/11 16:35:37 by apommier #+# #+# */
/* Updated: 2022/04/20 14:29:10 by apommier ### ########.fr */
/* Updated: 2022/04/20 15:49:47 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -23,8 +23,9 @@ char *cut_str(char *str, int start, int end)
swap = ft_strjoin(&str[end], 0);
str[start] = 0;
str = ft_strjoin(str, swap);
//free(del);
free(swap);
free(del);
if (swap)
free(swap);
return (str);
}