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'.
---
linux-user/syscall.c +1 -1
@@ -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
Riku Voipio
Acked-byHi,
You are right. This is what I get for only checking the manpage.
Quoted 23 lines · Arnaud Patard
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_getcwdsyscall should return the number of bytes written to the buffer including the '\0'.Signed-off-by Arnaud Patard <[email protected]>---
linux-user/syscall.c +1
-1@@ -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
Signature · 1 line
"rm -rf" only sounds scary if you don't have backups
Aurelien Jarno
AppliedQuoted 9 lines · Arnaud Patard
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_getcwdsyscall should return the number of bytes written to the buffer including the '\0'.Signed-off-by Arnaud Patard <[email protected]>---
Thanks, applied.
Quoted 13 lines
linux-user/syscall.c +1
-1@@ -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
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net