From: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] linux-user: fix getcwd syscall
Date: Thu, 16 Apr 2009 15:04:23 +0200 [thread overview]
Message-ID: <87ab6ghhrc.fsf@lechat.rtp-net.org> (raw)
[-- 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
next reply other threads:[~2009-04-16 12:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-16 13:04 Arnaud Patard [this message]
2009-04-16 14:09 ` [Qemu-devel] linux-user: fix getcwd syscall Riku Voipio
2009-04-16 14:17 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ab6ghhrc.fsf@lechat.rtp-net.org \
--to=arnaud.patard@rtp-net.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.