fix exec and mount error code

This commit is contained in:
zhao maosheng 2024-07-18 13:25:37 +08:00
parent 1d78d11567
commit a6b2014214
2 changed files with 9 additions and 3 deletions

View File

@ -127,7 +127,7 @@ int dfs_mount(const char *device_name,
}
else
{
rt_set_errno(ENOENT);
rt_set_errno(ENODEV);
ret = -1;
}

View File

@ -2172,7 +2172,7 @@ rt_weak sysret_t sys_vfork(void)
sysret_t sys_execve(const char *path, char *const argv[], char *const envp[])
{
int error = -1;
rt_err_t error = -1;
size_t len;
struct rt_lwp *new_lwp = NULL;
struct rt_lwp *lwp;
@ -2223,8 +2223,9 @@ sysret_t sys_execve(const char *path, char *const argv[], char *const envp[])
if (access(kpath, X_OK) != 0)
{
error = rt_get_errno();
rt_free(kpath);
return -EACCES;
return (sysret_t)error;
}
/* setup args */
@ -5784,6 +5785,11 @@ sysret_t sys_mount(char *source, char *target,
copy_source = NULL;
}
ret = dfs_mount(copy_source, copy_target, copy_filesystemtype, 0, tmp);
if (ret < 0)
{
ret = -rt_get_errno();
}
rt_free(copy_source);
return ret;