diff mbox

[v2] linux-user: Return target error number in do_fork()

Message ID 1440977181-24559-1-git-send-email-T.E.Baldwin99@members.leeds.ac.uk
State New
Headers show

Commit Message

Timothy Baldwin Aug. 30, 2015, 11:26 p.m. UTC
Whilst calls to do_fork() are wrapped in get_errno() this does not
translate return values.

Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
---
 linux-user/syscall.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Peter Maydell Aug. 30, 2015, 11:32 p.m. UTC | #1
On 31 August 2015 at 00:26, Timothy E Baldwin
<T.E.Baldwin99@members.leeds.ac.uk> wrote:
> Whilst calls to do_fork() are wrapped in get_errno() this does not
> translate return values.
>
> Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
> ---
>  linux-user/syscall.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index f62c698..264debc 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -4622,8 +4622,9 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
>          pthread_mutex_unlock(&clone_lock);
>      } else {
>          /* if no CLONE_VM, we consider it is a fork */
> -        if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0)
> -            return -EINVAL;
> +        if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0) {
> +            return -TARGET_EINVAL;
> +        }
>          fork_start();
>          ret = fork();
>          if (ret == 0) {
> --
> 2.1.4

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f62c698..264debc 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4622,8 +4622,9 @@  static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp,
         pthread_mutex_unlock(&clone_lock);
     } else {
         /* if no CLONE_VM, we consider it is a fork */
-        if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0)
-            return -EINVAL;
+        if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0) {
+            return -TARGET_EINVAL;
+        }
         fork_start();
         ret = fork();
         if (ret == 0) {