提交 0f6bb195 编写于 作者: A Andreas Schwab 提交者: Laurent Vivier

linux-user: Use getcwd syscall directly

The glibc getcwd function returns different errors than the getcwd
syscall, which triggers an assertion failure in the glibc getcwd function
when running under the emulation.

When the syscall returns ENAMETOOLONG, the glibc wrapper uses a fallback
implementation that potentially handles an unlimited path length, and
returns with ERANGE if the provided buffer is too small.  The qemu
emulation cannot distinguish the two cases, and thus always returns ERANGE.
This is unexpected by the glibc wrapper.
Signed-off-by: NAndreas Schwab <schwab@suse.de>
Reviewed-by: NLaurent Vivier <laurent@vivier.eu>
Message-Id: <mvmmu3qplvi.fsf@suse.de>
[lv: updated description]
Signed-off-by: NLaurent Vivier <laurent@vivier.eu>
上级 4d213001
......@@ -388,14 +388,7 @@ static bitmask_transtbl fcntl_flags_tbl[] = {
{ 0, 0, 0, 0 }
};
static int sys_getcwd1(char *buf, size_t size)
{
if (getcwd(buf, size) == NULL) {
/* getcwd() sets errno */
return (-1);
}
return strlen(buf)+1;
}
_syscall2(int, sys_getcwd1, char *, buf, size_t, size)
#ifdef TARGET_NR_utimensat
#if defined(__NR_utimensat)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册