mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
fix(exec): return code 126 when command is found but permission denied
This commit is contained in:
parent
9d37d07589
commit
527a624765
2 changed files with 14 additions and 5 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/02 18:19:23 by khais #+# #+# */
|
||||
/* Updated: 2025/04/18 09:23:00 by khais ### ########.fr */
|
||||
/* Updated: 2025/04/24 17:40:01 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
#include "../../parser/simple_cmd/simple_cmd.h"
|
||||
#include "../../subst/path_split.h"
|
||||
#include <dirent.h>
|
||||
#include "../../ft_errno.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
|
@ -57,12 +56,11 @@ static int ft_execve(char *exe, char **argv, char **envp)
|
|||
retvalue = 127;
|
||||
execve(exe, argv, envp);
|
||||
olderrno = errno;
|
||||
if (olderrno == EACCES)
|
||||
retvalue = 126;
|
||||
if (ft_is_directory(exe))
|
||||
{
|
||||
ft_dprintf(STDERR_FILENO, "minishell: %s: %s\n", argv[0],
|
||||
strerror(EISDIR));
|
||||
retvalue = 126;
|
||||
}
|
||||
else
|
||||
ft_dprintf(STDERR_FILENO, "minishell: %s: %s\n", argv[0],
|
||||
strerror(olderrno));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue