Skip to contentSkip to conversation

[7130] linux-user: fix getcwd syscall

Qemu-devel Aurelien Jarno 1 participant 1 message Apr 16, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 7130

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7130
Author:   aurel32
Date:     2009-04-16 14:17:14 +0000 (Thu, 16 Apr 2009)

Log Message:
-----------
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'.

Modified Paths:
--------------
trunk/linux-user/syscall.c

Modified: trunk/linux-user/syscall.c
===================================================================

linux-user/syscall.c +1 -1
@@ -293,7 +293,7 @@
       /* getcwd() sets errno */
       return (-1);
   }
-  return (0);
+  return strlen(buf)+1;
 }
 
 #ifdef CONFIG_ATFILE