diff --git a/Makefile b/Makefile index da83c448..4ab67fa3 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/08/12 17:05:19 by maiboyer ### ########.fr # +# Updated: 2024/08/12 17:53:35 by rparodi ### ########.fr # # # # **************************************************************************** # @@ -44,7 +44,7 @@ endif endif # TODO: ADD THIS WHEN FINISHING THIS: -# CFLAGS_ADDITIONAL += -DNVALGRIND +CFLAGS_ADDITIONAL += -DNVALGRIND CFLAGS_ADDITIONAL += -O0 -Wno-cpp # TODO: REMOVE THIS WHEN FINISHING THIS: diff --git a/exec/src/builtins/env.c b/exec/src/builtins/env.c index 4d4bac53..375f0601 100644 --- a/exec/src/builtins/env.c +++ b/exec/src/builtins/env.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/07 14:22:50 by rparodi #+# #+# */ -/* Updated: 2024/08/11 12:49:51 by maiboyer ### ########.fr */ +/* Updated: 2024/08/12 14:16:45 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/exec/src/builtins/pwd.c b/exec/src/builtins/pwd.c index 64439338..26f2f611 100644 --- a/exec/src/builtins/pwd.c +++ b/exec/src/builtins/pwd.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/08/07 13:58:37 by rparodi #+# #+# */ -/* Updated: 2024/08/11 11:26:12 by maiboyer ### ########.fr */ +/* Updated: 2024/08/12 18:14:08 by rparodi ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,7 @@ #include "me/mem/mem.h" #include "me/string/string.h" #include "me/types.h" +#include t_error builtin_pwd___(t_state *state, t_builtin_spawn_info info, t_i32 *exit_code) { @@ -21,7 +22,12 @@ t_error builtin_pwd___(t_state *state, t_builtin_spawn_info info, t_i32 *exit_co s = string_new(1024); while (getcwd(s.buf, s.capacity - 1) == NULL) - string_reserve(&s, s.capacity * 2); + { + if (errno == ERANGE) + string_reserve(&s, s.capacity * 3); + else + return (string_free(s), ERROR); + } printf("%s\n", s.buf); string_free(s); return (*exit_code = 0, NO_ERROR);