func explains itself really

This commit is contained in:
Quinten Mennen 2025-02-27 16:21:44 +01:00
parent c2f062c671
commit e5b30c8796

View File

@ -6,7 +6,7 @@
/* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */ /* By: qmennen <qmennen@student.codam.nl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/02/12 21:25:10 by willem #+# #+# */ /* Created: 2025/02/12 21:25:10 by willem #+# #+# */
/* Updated: 2025/02/27 13:50:26 by qmennen ### ########.fr */ /* Updated: 2025/02/27 16:20:00 by qmennen ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -22,7 +22,7 @@ static int is_dir(char *path)
error_msg("is_dir", "path could not be read"); error_msg("is_dir", "path could not be read");
return (0); return (0);
} }
return S_ISDIR(path_stats.st_mode); return (S_ISDIR(path_stats.st_mode));
} }
void executor_child(t_minishell *msh, t_command *command) void executor_child(t_minishell *msh, t_command *command)
@ -35,7 +35,6 @@ void executor_child(t_minishell *msh, t_command *command)
dup2(command->fd_out, 1); dup2(command->fd_out, 1);
executor_close_fds(command->n_fds); executor_close_fds(command->n_fds);
path = executor_absolute_path(msh, command->args[0]); path = executor_absolute_path(msh, command->args[0]);
// TODO: If the path variable points to a dir, it exists so the command won't fail (while ofc it should?)
if (path == NULL || access(path, F_OK | X_OK) != 0) if (path == NULL || access(path, F_OK | X_OK) != 0)
{ {
ft_putstr_fd(RED BOLD, 2); ft_putstr_fd(RED BOLD, 2);