From e97ba95f71bd080be62ed9a389b2239f2578ec6f Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 26 Dec 2022 01:41:10 -0500 Subject: [PATCH] [libc][unistd.h] define F_OK --- components/libc/compilers/common/include/sys/unistd.h | 5 +++++ components/utilities/ulog/backend/file_be.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/libc/compilers/common/include/sys/unistd.h b/components/libc/compilers/common/include/sys/unistd.h index 0eaf52423c..b9c64f3bb6 100644 --- a/components/libc/compilers/common/include/sys/unistd.h +++ b/components/libc/compilers/common/include/sys/unistd.h @@ -23,6 +23,11 @@ extern "C" { #define STDOUT_FILENO 1 /* standard output file descriptor */ #define STDERR_FILENO 2 /* standard error file descriptor */ +#define F_OK 0 +#define X_OK 1 +#define W_OK 2 +#define R_OK 4 + unsigned alarm(unsigned __secs); ssize_t read(int fd, void *buf, size_t len); ssize_t write(int fd, const void *buf, size_t len); diff --git a/components/utilities/ulog/backend/file_be.c b/components/utilities/ulog/backend/file_be.c index 62f3f7ad83..a57f2c82a7 100644 --- a/components/utilities/ulog/backend/file_be.c +++ b/components/utilities/ulog/backend/file_be.c @@ -86,7 +86,7 @@ static void ulog_file_backend_flush_with_buf(struct ulog_backend *backend) if (be->cur_log_file_fd < 0) { /* check log file directory */ - if (access(be->cur_log_dir_path, 0) < 0) + if (access(be->cur_log_dir_path, F_OK) < 0) { mkdir(be->cur_log_dir_path, 0); }