【修复】修复symlink系统调用返回值不是预期问题

This commit is contained in:
zhuzhuzhu 2024-08-25 22:56:03 +08:00 committed by GitHub
parent 8ba75bddc3
commit c4c227e367
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 7 deletions

View File

@ -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);

View File

@ -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)