From 20b46c7c697ce9d833141abe9aa0ea6101f00ae2 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 22 Mar 2020 12:57:36 -0700 Subject: runtime: negate errno value for mips pipe/pipe2 The callers expect negative errno values, so negate them when necessary. No test because there is no reasonable way to make pipe/pipe2 fail. This was reported on a system on which pipe2 returned ENOSYS. Fixes #37997 Change-Id: I3ad6cbbc2521cf495f8df6ec991a3f781122b508 Reviewed-on: https://go-review.googlesource.com/c/go/+/224592 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Tobias Klauser --- src/runtime/sys_linux_mipsx.s | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/runtime/sys_linux_mipsx.s') diff --git a/src/runtime/sys_linux_mipsx.s b/src/runtime/sys_linux_mipsx.s index 15893a7a28..fab2ab3892 100644 --- a/src/runtime/sys_linux_mipsx.s +++ b/src/runtime/sys_linux_mipsx.s @@ -118,6 +118,7 @@ TEXT runtime·pipe(SB),NOSPLIT,$0-12 MOVW $-1, R1 MOVW R1, r+0(FP) MOVW R1, w+4(FP) + SUBU R2, R0, R2 // caller expects negative errno MOVW R2, errno+8(FP) RET pipeok: @@ -132,6 +133,8 @@ TEXT runtime·pipe2(SB),NOSPLIT,$0-16 MOVW flags+0(FP), R5 MOVW $SYS_pipe2, R2 SYSCALL + BEQ R7, 2(PC) + SUBU R2, R0, R2 // caller expects negative errno MOVW R2, errno+12(FP) RET -- cgit v1.3-5-g9baa