From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LuRBl-0000Ad-HF for qemu-devel@nongnu.org; Thu, 16 Apr 2009 08:59:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LuRBk-00009n-Al for qemu-devel@nongnu.org; Thu, 16 Apr 2009 08:59:32 -0400 Received: from [199.232.76.173] (port=57235 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LuRBk-00009j-7e for qemu-devel@nongnu.org; Thu, 16 Apr 2009 08:59:32 -0400 Received: from lechat.rtp-net.org ([88.191.19.38]:51950) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LuRBj-0006SM-Mb for qemu-devel@nongnu.org; Thu, 16 Apr 2009 08:59:31 -0400 Received: from lechat.rtp-net.org (localhost [127.0.0.1]) by lechat.rtp-net.org (Postfix) with ESMTP id 126A310087 for ; Thu, 16 Apr 2009 15:04:24 +0200 (CEST) From: Arnaud Patard (Rtp) Date: Thu, 16 Apr 2009 15:04:23 +0200 Message-ID: <87ab6ghhrc.fsf@lechat.rtp-net.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Subject: [Qemu-devel] linux-user: fix getcwd syscall Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --=-=-= 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 --- --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=fix_sys_getcwd.patch 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 --=-=-=--