no leaks env -bad option

This commit is contained in:
Antoine Riard 2017-03-27 18:53:33 +02:00
parent 41b42d8803
commit 1fb76725c2
4 changed files with 9 additions and 5 deletions

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/22 16:20:31 by gwojda #+# #+# */
/* Updated: 2017/03/25 20:40:41 by jhalford ### ########.fr */
/* Updated: 2017/03/27 18:52:26 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -71,7 +71,10 @@ int builtin_env(const char *path,
(void)envp;
if (bt_env_parse(&dat, (char**)argv))
{
ft_sstrfree(dat.custom_env);
return (ft_perror("env") && SH_ERR("usage: %s", ENV_USAGE));
}
if (!*dat.av_data)
return (display_env(dat.custom_env));
else if ((pid = fork()) == 0)

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/09 20:39:06 by jhalford #+# #+# */
/* Updated: 2017/03/27 18:13:03 by jhalford ### ########.fr */
/* Updated: 2017/03/27 18:39:55 by ariard ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/27 18:12:03 by jhalford #+# #+# */
/* Updated: 2017/03/27 18:18:55 by jhalford ### ########.fr */
/* Updated: 2017/03/27 18:53:10 by ariard ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,7 +17,8 @@ int lexer_bang(t_list **alst, t_lexer *lexer)
t_token *token;
token = (*alst)->content;
if (token->type)
if (!token->type || token->type == TK_SEMI || token->type == TK_NEWLINE
|| token->type == TK_AMP)
{
token->type = TK_BANG;
lexer->state = DEFAULT;

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */
/* Updated: 2017/03/27 18:08:20 by ariard ### ########.fr */
/* Updated: 2017/03/27 18:28:37 by ariard ### ########.fr */
/* */
/* ************************************************************************** */