From 5c0572151bfcc52409ffd27b53d41648b8a62668 Mon Sep 17 00:00:00 2001 From: aurel32 Date: Thu, 16 Apr 2009 14:17:14 +0000 Subject: [PATCH] linux-user: fix getcwd syscall 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 Acked-By: Riku Voipio Signed-off-by: Aurelien Jarno git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7130 c046a42c-6fe2-441c-8c8c-71466251a162 --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.7.4