Commit 89da278b by Fear1ess

4/8

parent a907e0e0
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "wd_syscall.h" #include "wd_syscall.h"
#include "syscall.h" #include "syscall.h"
#include "fcntl.h" #include "fcntl.h"
#include "errno.h"
IMPORTWDSYSCALL IMPORTWDSYSCALL
...@@ -149,12 +150,9 @@ int read_file(const char *file_path, const char *mode, char *r_buf, size_t r_len ...@@ -149,12 +150,9 @@ int read_file(const char *file_path, const char *mode, char *r_buf, size_t r_len
} }
int is_file_exists(const char *file_path) { int is_file_exists(const char *file_path) {
int res; int fd = WDSYSCALL(SYS_faccessat, AT_FDCWD, file_path, R_OK, 0);
int fd = WDSYSCALL(SYS_openat, AT_FDCWD, file_path, O_RDONLY, 0); int err = errno;
if(fd == -1) res = 0; if(fd == -1) return 0;
else {
WDSYSCALL(SYS_close, fd); WDSYSCALL(SYS_close, fd);
res = 1; return 1;
}
return res;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment