Skip to content

Commit 666b24b

Browse files
committed
fix: Return MALLOC_ERROR when pwd fails bc of no memory
1 parent 0b8659d commit 666b24b

File tree

1 file changed

+4
-1
lines changed
  • source/backend/builtins

1 file changed

+4
-1
lines changed

source/backend/builtins/pwd.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ int exec_pwd(void)
2121
{
2222
print_error("%s: %s: ", PROGRAM_NAME, "pwd");
2323
perror(NULL);
24-
return (GENERAL_ERROR);
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)