Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LuSPM-0001rH-Qj for qemu-devel@nongnu.org; Thu, 16 Apr 2009 10:17:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LuSPM-0001ql-4B for qemu-devel@nongnu.org; Thu, 16 Apr 2009 10:17:40 -0400 Received: from [199.232.76.173] (port=39176 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LuSPL-0001qh-Rd for qemu-devel@nongnu.org; Thu, 16 Apr 2009 10:17:39 -0400 Received: from hall.aurel32.net ([88.191.82.174]:60887) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LuSPL-0003Wm-G9 for qemu-devel@nongnu.org; Thu, 16 Apr 2009 10:17:39 -0400 Date: Thu, 16 Apr 2009 16:17:36 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] linux-user: fix getcwd syscall Message-ID: <20090416141736.GB9160@volta.aurel32.net> References: <87ab6ghhrc.fsf@lechat.rtp-net.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <87ab6ghhrc.fsf@lechat.rtp-net.org> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Arnaud Patard Cc: qemu-devel@nongnu.org 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 > --- Thanks, applied. > 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 -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net