diff --git a/components/dfs/dfs_v2/src/dfs_file.c b/components/dfs/dfs_v2/src/dfs_file.c index 53e110ef59..1f98d5ceab 100644 --- a/components/dfs/dfs_v2/src/dfs_file.c +++ b/components/dfs/dfs_v2/src/dfs_file.c @@ -1567,6 +1567,10 @@ int dfs_file_symlink(const char *target, const char *linkpath) rt_free(parent); } } + else + { + rt_set_errno(-EPERM); + } if (fullpath != linkpath) rt_free(fullpath); diff --git a/components/lwp/lwp_syscall.c b/components/lwp/lwp_syscall.c index bbb0573c5c..077f6d86af 100644 --- a/components/lwp/lwp_syscall.c +++ b/components/lwp/lwp_syscall.c @@ -5909,28 +5909,31 @@ sysret_t sys_link(const char *existing, const char *new) sysret_t sys_symlink(const char *existing, const char *new) { int ret = -1; - + int err = 0 ; #ifdef ARCH_MM_MMU - int err; - err = lwp_user_strlen(existing); - if (err <= 0) + ret = lwp_user_strlen(existing); + if (ret <= 0) { return -EFAULT; } - err = lwp_user_strlen(new); - if (err <= 0) + ret = lwp_user_strlen(new); + if (ret <= 0) { return -EFAULT; } #endif #ifdef RT_USING_DFS_V2 ret = dfs_file_symlink(existing, new); + if(ret < 0) + { + err = GET_ERRNO(); + } #else SET_ERRNO(EFAULT); #endif - return (ret < 0 ? GET_ERRNO() : ret); + return (err < 0 ? err : ret); } sysret_t sys_eventfd2(unsigned int count, int flags)