diff options
| author | Bernard Xiong <[email protected]> | 2021-02-15 09:28:48 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-15 09:28:48 +0800 |
| commit | d1cb9c5d97dea5639bf366765581b7ae09b61e47 (patch) | |
| tree | a1264dce8e7c2c6fc77bf7032553b03caa707787 /components | |
| parent | 7d72bdf303f1b876c276694007f20622a126b19f (diff) | |
| parent | c842f2a067a04ceb5ba3ba414110db058c92c1f5 (diff) | |
Merge pull request #4341 from mysterywolf/unlink
[libc][iar][gcc] 优化remove函数
Diffstat (limited to 'components')
| -rw-r--r-- | components/libc/compilers/dlib/syscall_remove.c | 10 | ||||
| -rw-r--r-- | components/libc/compilers/newlib/syscalls.c | 7 |
2 files changed, 7 insertions, 10 deletions
diff --git a/components/libc/compilers/dlib/syscall_remove.c b/components/libc/compilers/dlib/syscall_remove.c index e7f0268b1b..f7e64d1997 100644 --- a/components/libc/compilers/dlib/syscall_remove.c +++ b/components/libc/compilers/dlib/syscall_remove.c @@ -9,16 +9,16 @@ */ #include <rtthread.h> #ifdef RT_USING_DFS -#include <dfs_file.h> +#include <dfs_posix.h> #endif #include <yfuns.h> #pragma module_name = "?remove" int remove(const char *val) { -#ifdef RT_USING_DFS - dfs_file_unlink(val); +#ifndef RT_USING_DFS + return -1; +#else + return unlink(val); #endif - - return 0; } diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index ae8b51b672..cf98e0c3ec 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -197,12 +197,9 @@ int _unlink_r(struct _reent *ptr, const char *file) { #ifndef RT_USING_DFS - return 0; + return -1; #else - int rc; - - rc = unlink(file); - return rc; + return unlink(file); #endif } |
