From: Tobias Klauser Date: Wed, 17 May 2023 07:38:20 +0000 (+0200) Subject: runtime: report correct fcntl syscall error in checkCloseonexec X-Git-Tag: go1.21rc1~427 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9ed2b115fb405bf730772d0e825876d85deb7340;p=gostls13.git runtime: report correct fcntl syscall error in checkCloseonexec runtime.fcntl returns the error value as a negative value, so it needs to be inverted before being converted to syscall.Errno. Change-Id: I43cd0b035150424ac59e623b17a9396c7d62c186 Reviewed-on: https://go-review.googlesource.com/c/go/+/495675 TryBot-Result: Gopher Robot Auto-Submit: Tobias Klauser Reviewed-by: Bryan Mills Run-TryBot: Tobias Klauser Reviewed-by: Ian Lance Taylor --- diff --git a/src/runtime/nbpipe_test.go b/src/runtime/nbpipe_test.go index bb21003c35..378257261d 100644 --- a/src/runtime/nbpipe_test.go +++ b/src/runtime/nbpipe_test.go @@ -67,7 +67,7 @@ func checkCloseonexec(t *testing.T, fd int32, name string) { t.Helper() flags := runtime.Fcntl(fd, syscall.F_GETFD, 0) if flags < 0 { - t.Errorf("fcntl(%s, F_GETFD) failed: %v", name, syscall.Errno(flags)) + t.Errorf("fcntl(%s, F_GETFD) failed: %v", name, syscall.Errno(-flags)) } else if flags&syscall.FD_CLOEXEC == 0 { t.Errorf("FD_CLOEXEC not set in %s flags %#x", name, flags) }