Merge pull request #9208 from zmshahaha/errno

[components][lwp]fix exec and mount error code
This commit is contained in:
Bernard Xiong 2024-07-18 20:32:06 +08:00 committed by GitHub
commit 937f0dbf5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -127,7 +127,7 @@ int dfs_mount(const char *device_name,
} }
else else
{ {
rt_set_errno(ENOENT); rt_set_errno(ENODEV);
ret = -1; 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[]) sysret_t sys_execve(const char *path, char *const argv[], char *const envp[])
{ {
int error = -1; rt_err_t error = -1;
size_t len; size_t len;
struct rt_lwp *new_lwp = NULL; struct rt_lwp *new_lwp = NULL;
struct rt_lwp *lwp; 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) if (access(kpath, X_OK) != 0)
{ {
error = rt_get_errno();
rt_free(kpath); rt_free(kpath);
return -EACCES; return (sysret_t)error;
} }
/* setup args */ /* setup args */
@ -5784,6 +5785,11 @@ sysret_t sys_mount(char *source, char *target,
copy_source = NULL; copy_source = NULL;
} }
ret = dfs_mount(copy_source, copy_target, copy_filesystemtype, 0, tmp); ret = dfs_mount(copy_source, copy_target, copy_filesystemtype, 0, tmp);
if (ret < 0)
{
ret = -rt_get_errno();
}
rt_free(copy_source); rt_free(copy_source);
return ret; return ret;