【修复】修复link系统调用返回值问题
This commit is contained in:
parent
dc232080a0
commit
1be24fc7da
|
@ -1379,6 +1379,7 @@ int dfs_file_link(const char *oldname, const char *newname)
|
||||||
|
|
||||||
if (dfs_file_isdir(oldname) == 0)
|
if (dfs_file_isdir(oldname) == 0)
|
||||||
{
|
{
|
||||||
|
rt_set_errno(-EPERM);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5013,7 +5013,8 @@ ssize_t sys_readlink(char* path, char *buf, size_t bufsz)
|
||||||
err = dfs_file_readlink(copy_path, link_fn, DFS_PATH_MAX);
|
err = dfs_file_readlink(copy_path, link_fn, DFS_PATH_MAX);
|
||||||
if (err > 0)
|
if (err > 0)
|
||||||
{
|
{
|
||||||
rtn = lwp_put_to_user(buf, link_fn, bufsz > err ? err : bufsz - 1);
|
buf[bufsz > err ? err : bufsz] = '\0';
|
||||||
|
rtn = lwp_put_to_user(buf, link_fn, bufsz > err ? err : bufsz);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5855,7 +5856,7 @@ sysret_t sys_umount2(char *__special_file, int __flags)
|
||||||
sysret_t sys_link(const char *existing, const char *new)
|
sysret_t sys_link(const char *existing, const char *new)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
int err = 0;
|
||||||
#ifdef RT_USING_DFS_V2
|
#ifdef RT_USING_DFS_V2
|
||||||
#ifdef ARCH_MM_MMU
|
#ifdef ARCH_MM_MMU
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
@ -5902,6 +5903,10 @@ sysret_t sys_link(const char *existing, const char *new)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dfs_file_link(kexisting, knew);
|
ret = dfs_file_link(kexisting, knew);
|
||||||
|
if(ret < 0)
|
||||||
|
{
|
||||||
|
err = GET_ERRNO();
|
||||||
|
}
|
||||||
|
|
||||||
kmem_put(knew);
|
kmem_put(knew);
|
||||||
kmem_put(kexisting);
|
kmem_put(kexisting);
|
||||||
|
@ -5910,9 +5915,10 @@ sysret_t sys_link(const char *existing, const char *new)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
SET_ERRNO(EFAULT);
|
SET_ERRNO(EFAULT);
|
||||||
|
err = GET_ERRNO();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (ret < 0 ? GET_ERRNO() : ret);
|
return (err < 0 ? err : ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
sysret_t sys_symlink(const char *existing, const char *new)
|
sysret_t sys_symlink(const char *existing, const char *new)
|
||||||
|
|
Loading…
Reference in New Issue