linux-user: Use getcwd syscall directly
commit0f6bb1958f3aae0171996941df7fb7ea7536bb12
authorAndreas Schwab <schwab@suse.de>
Thu, 23 Jul 2020 10:27:13 +0000 (23 12:27 +0200)
committerLaurent Vivier <laurent@vivier.eu>
Mon, 27 Jul 2020 20:05:34 +0000 (27 22:05 +0200)
treecfe4f1dd08ee6e0d609ec5b4902448e0055a9136
parent4d213001b356c4a24c05afbc72f4860088900627
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: Andreas Schwab <schwab@suse.de>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <mvmmu3qplvi.fsf@suse.de>
[lv: updated description]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
linux-user/syscall.c