qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] linux-user: fix getcwd syscall


From: Riku Voipio
Subject: Re: [Qemu-devel] linux-user: fix getcwd syscall
Date: Thu, 16 Apr 2009 17:09:12 +0300
User-agent: Mutt/1.5.18 (2008-05-17)

Hi,

You are right. This is what I get for only checking the manpage.

Acked-By: Riku Voipio <address@hidden>

On Thu, Apr 16, 2009 at 03:04:23PM +0200, Arnaud Patard wrote:
> 
> The patch called "prefer glibc over direct syscalls" (commit 7118) has
> replaced the getcwd syscall with a call to the glibc. With this change,
> the syscall is returning -1 in error case and 0 otherwise.
> This is problematic as the sys_getcwd syscall should return the number
> of bytes written to the buffer including the '\0'.
> 
> Signed-off-by: Arnaud Patard <address@hidden>
> ---

> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 74b41a8..f5875aa 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -293,7 +293,7 @@ static int sys_getcwd1(char *buf, size_t size)
>        /* getcwd() sets errno */
>        return (-1);
>    }
> -  return (0);
> +  return strlen(buf)+1;
>  }
>  
>  #ifdef CONFIG_ATFILE


-- 
"rm -rf" only sounds scary if you don't have backups




reply via email to

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