qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] linux-user: Use getcwd syscall directly


From: Laurent Vivier
Subject: Re: [PATCH] linux-user: Use getcwd syscall directly
Date: Tue, 7 Apr 2020 12:36:56 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

Le 06/04/2020 à 17:18, Andreas Schwab a écrit :
> The glibc getcwd function returns different errors than the getcwd
> syscall, which triggers an assertion failure in the glibc getcwd function
> when running under the emulation.
> 
> Signed-off-by: Andreas Schwab <address@hidden>
> ---
>  linux-user/syscall.c | 9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 83c2891169..90c5433fec 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -375,14 +375,7 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
>    { 0, 0, 0, 0 }
>  };
>  
> -static int sys_getcwd1(char *buf, size_t size)
> -{
> -  if (getcwd(buf, size) == NULL) {
> -      /* getcwd() sets errno */
> -      return (-1);
> -  }
> -  return strlen(buf)+1;
> -}
> +_syscall2(int, sys_getcwd1, char *, buf, size_t, size)
>  
>  #ifdef TARGET_NR_utimensat
>  #if defined(__NR_utimensat)
> 

According to the commit introducing the function, it could break fakeroot:

commit 3b3f24add09f8ab720860d4840f9755c102121b5
Author: Aurelien Jarno <address@hidden>
Date:   Wed Apr 15 16:12:13 2009 +0000

    linux-user: prefer glibc over direct syscalls

    The openat/*at syscalls are incredibly common with modern coreutils,
    calling them directly via syscalls breaks for example fakeroot. Use
    glibc stubs whenever directly available and provide old syscall
    calling for people still using older libc.

    Patch originally from Mika Westerberg, Adapted to
    apply to current trunk and cleaned up by Riku Voipio.

    Signed-off-by: Riku Voipio <address@hidden>
    Signed-off-by: Aurelien Jarno <address@hidden>

Thanks,
Laurent



reply via email to

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