In 2010, the commit b41a66edd0c added a thrird parameter "is_pipe2" to the internal do_pipe() function, but missed to actually use this parameter to decide if the pipe() or pipe2() syscall should be used. Instead it just continued to check the flags parameter and used pipe2() unconditionally if flags is non-zero.
This change should make a difference for the ALPHA, MIPS, SH4 and SPARC targets if the emulated code calls pipe2() with a flags value of 0. Fixes: fb41a66edd0c ("alpha-linux-user: Fix pipe return mechanism.") Cc: Richard Henderson <r...@twiddle.net> Cc: Aurelien Jarno <aurel...@aurel32.net> diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 991b85e6b4..1e6e814871 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1600,7 +1600,7 @@ static abi_long do_pipe(CPUArchState *cpu_env, abi_ulong pipedes, { int host_pipe[2]; abi_long ret; - ret = flags ? do_pipe2(host_pipe, flags) : pipe(host_pipe); + ret = is_pipe2 ? do_pipe2(host_pipe, flags) : pipe(host_pipe); if (is_error(ret)) return get_errno(ret);