All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] linux-user: fix getcwd syscall
@ 2009-04-16 13:04 Arnaud Patard
  2009-04-16 14:09 ` Riku Voipio
  2009-04-16 14:17 ` Aurelien Jarno
  0 siblings, 2 replies; 3+ messages in thread
From: Arnaud Patard @ 2009-04-16 13:04 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]


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>
---

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fix_sys_getcwd.patch --]
[-- Type: text/x-diff, Size: 333 bytes --]

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-16 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-16 13:04 [Qemu-devel] linux-user: fix getcwd syscall Arnaud Patard
2009-04-16 14:09 ` Riku Voipio
2009-04-16 14:17 ` Aurelien Jarno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.