diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-26 16:30:22 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-08-26 16:30:22 +0200 |
commit | 0cdd4719ca55e1084c37c7dab192ceb4e277650c (patch) | |
tree | 0d13a3a1d6fb650ad73d9fd2dba32c1c70ab5df5 | |
parent | File tests, all good (diff) | |
download | 42-minishell-0cdd4719ca55e1084c37c7dab192ceb4e277650c.tar.gz 42-minishell-0cdd4719ca55e1084c37c7dab192ceb4e277650c.tar.bz2 42-minishell-0cdd4719ca55e1084c37c7dab192ceb4e277650c.tar.xz 42-minishell-0cdd4719ca55e1084c37c7dab192ceb4e277650c.tar.zst 42-minishell-0cdd4719ca55e1084c37c7dab192ceb4e277650c.zip |
in progress
-rw-r--r-- | src/b_sqb_file.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/b_sqb_file.c b/src/b_sqb_file.c index 02ad601..d876516 100644 --- a/src/b_sqb_file.c +++ b/src/b_sqb_file.c @@ -38,7 +38,7 @@ static t_bool return (TRUE); else if (id == FT_ID_SQB_R && access(path, R_OK) == 0) return (TRUE); - else if (id == FT_ID_SQB_S && st->st_size != 0) + else if (id == FT_ID_SQB_S && st->st_size > 0) return (TRUE); else if (id == FT_ID_SQB_W && access(path, W_OK) == 0) return (TRUE); @@ -56,14 +56,10 @@ uint8_t struct stat st; int32_t fd; - if ((fd = open(argv[1], O_RDONLY)) == -1) + if (access(argv[1], 0) == -1) return (1); if (id == FT_ID_SQB_E) - { - close(fd); return (0); - } - close(fd); if (id == FT_ID_SQB_H || id == FT_ID_SQB_L_MAJ) lstat(argv[1], &st); else |