☔ c'est bueno les enfants
This commit is contained in:
parent
6b67ceb224
commit
2e49e0c302
2 changed files with 7 additions and 6 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/25 01:40:31 by jhalford #+# #+# */
|
/* Created: 2017/03/25 01:40:31 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/25 01:42:02 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 16:58:21 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,6 +16,7 @@ int is_directory(const char *path)
|
||||||
{
|
{
|
||||||
struct stat path_stat;
|
struct stat path_stat;
|
||||||
|
|
||||||
stat(path, &path_stat);
|
if (stat(path, &path_stat) != 0)
|
||||||
|
return (0);
|
||||||
return (S_ISDIR(path_stat.st_mode));
|
return (S_ISDIR(path_stat.st_mode));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/25 01:10:56 by jhalford #+# #+# */
|
/* Created: 2017/03/25 01:10:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/26 22:36:13 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 16:58:26 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,10 +15,10 @@
|
||||||
int try_access(char *file, int exists, t_flag a_flag)
|
int try_access(char *file, int exists, t_flag a_flag)
|
||||||
{
|
{
|
||||||
if (exists && access(file, F_OK) != 0)
|
if (exists && access(file, F_OK) != 0)
|
||||||
return (ERR_SET(E_SYS_NOFILE, file) * 0 - 1);
|
return (ERR_SET(E_SYS_NOFILE, file));
|
||||||
else if (is_directory(file))
|
else if (is_directory(file))
|
||||||
return (ERR_SET(E_SYS_ISDIR, file) * 0 - 1);
|
return (ERR_SET(E_SYS_ISDIR, file));
|
||||||
else if (access(file, F_OK) == 0 && access(file, a_flag) != 0)
|
else if (access(file, F_OK) == 0 && access(file, a_flag) != 0)
|
||||||
return (ERR_SET(E_SYS_NOPERM, file) * 0 - 1);
|
return (ERR_SET(E_SYS_NOPERM, file));
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue