Skip to content

Commit 4db26e6

Browse files
authored
Merge pull request #342 from LeaYeh/fix-pwd-exit-code
[FIX] Fix `pwd` exit code
2 parents 15ce908 + 666b24b commit 4db26e6

File tree

1 file changed

+6
-3
lines changed
  • source/backend/builtins

1 file changed

+6
-3
lines changed

source/backend/builtins/pwd.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
/* ::: :::::::: */
44
/* pwd.c :+: :+: :+: */
55
/* +:+ +:+ +:+ */
6-
/* By: lyeh <lyeh@student.42vienna.com> +#+ +:+ +#+ */
6+
/* By: ldulling <ldulling@student.42.fr> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2024/03/18 17:40:16 by lyeh #+# #+# */
9-
/* Updated: 2024/03/18 17:40:17 by lyeh ### ########.fr */
9+
/* Updated: 2024/06/01 12:25:09 by ldulling ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -21,7 +21,10 @@ int exec_pwd(void)
2121
{
2222
print_error("%s: %s: ", PROGRAM_NAME, "pwd");
2323
perror(NULL);
24-
return (CMD_EXEC_FAILED);
24+
if (errno == ENOMEM)
25+
return (MALLOC_ERROR);
26+
else
27+
return (GENERAL_ERROR);
2528
}
2629
ft_printf("%s\n", pwd);
2730
free(pwd);

0 commit comments

Comments
 (0)