Commit aaf4ad391333d78c73900befb9971ff26d4938d4
1 parent
69a218fc
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 <arnaud.patard@rtp-net.org> Acked-By: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7130 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
1 additions
and
1 deletions
linux-user/syscall.c
| @@ -293,7 +293,7 @@ static int sys_getcwd1(char *buf, size_t size) | @@ -293,7 +293,7 @@ static int sys_getcwd1(char *buf, size_t size) | ||
| 293 | /* getcwd() sets errno */ | 293 | /* getcwd() sets errno */ |
| 294 | return (-1); | 294 | return (-1); |
| 295 | } | 295 | } |
| 296 | - return (0); | 296 | + return strlen(buf)+1; |
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | #ifdef CONFIG_ATFILE | 299 | #ifdef CONFIG_ATFILE |