qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 15/34] linux-user: Remove redundant get_errno()


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 15/34] linux-user: Remove redundant get_errno() calls
Date: Thu, 10 Sep 2015 19:50:54 +0100

On 6 September 2015 at 00:57, Timothy E Baldwin
<address@hidden> wrote:
> The return value of openat was being translated by get_errno() twice.
> Fixed by removing calls of get_errno() in do_syscall() and keeping those
> in do_openat().
>
> Signed-off-by: Timothy Edward Baldwin <address@hidden>
> ---
>  linux-user/syscall.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index c213588..df9b2ca 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -5764,17 +5764,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long 
> arg1,
>      case TARGET_NR_open:
>          if (!(p = lock_user_string(arg1)))
>              goto efault;
> -        ret = get_errno(do_openat(cpu_env, AT_FDCWD, p,
> -                                  target_to_host_bitmask(arg2, 
> fcntl_flags_tbl),
> -                                  arg3));
> +        ret = do_openat(cpu_env, AT_FDCWD, p,
> +                        target_to_host_bitmask(arg2, fcntl_flags_tbl),
> +                        arg3);
>          unlock_user(p, arg1, 0);
>          break;
>      case TARGET_NR_openat:
>          if (!(p = lock_user_string(arg2)))
>              goto efault;
> -        ret = get_errno(do_openat(cpu_env, arg1, p,
> -                                  target_to_host_bitmask(arg3, 
> fcntl_flags_tbl),
> -                                  arg4));
> +        ret = do_openat(cpu_env, arg1, p,
> +                        target_to_host_bitmask(arg3, fcntl_flags_tbl),
> +                        arg4);
>          unlock_user(p, arg2, 0);
>          break;
>      case TARGET_NR_close:

Nice catch, but I don't think this patch is sufficient. There are still
code paths in do_openat() which aren't returning a target errno, like
the "mkstemp failed" case. The fake_open->fill functions are also not
generally returning target errnos.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]