* [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
* Re: [Qemu-devel] linux-user: fix getcwd syscall
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
1 sibling, 0 replies; 3+ messages in thread
From: Riku Voipio @ 2009-04-16 14:09 UTC (permalink / raw)
To: Arnaud Patard; +Cc: qemu-devel
Hi,
You are right. This is what I get for only checking the manpage.
Acked-By: Riku Voipio <riku.voipio@iki.fi>
On Thu, Apr 16, 2009 at 03:04:23PM +0200, Arnaud Patard wrote:
>
> 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>
> ---
> 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
--
"rm -rf" only sounds scary if you don't have backups
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] linux-user: fix getcwd syscall
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
1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2009-04-16 14:17 UTC (permalink / raw)
To: Arnaud Patard; +Cc: qemu-devel
On Thu, Apr 16, 2009 at 03:04:23PM +0200, Arnaud Patard wrote:
>
> 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>
> ---
Thanks, applied.
> 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
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [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.