From: Ian Lance Taylor Date: Tue, 25 Jul 2023 22:14:03 +0000 (-0700) Subject: runtime2: don't check fcntl errno in checkfds on AIX and Solaris X-Git-Tag: go1.22rc1~1533 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=12bd2445afffbf229bafc538260c37b5dc176479;p=gostls13.git runtime2: don't check fcntl errno in checkfds on AIX and Solaris On AIX and Solaris the errno value is fetched using m.mOS.perrno. When checkfds is called, that value has not yet been set up by minit. Since the error value doesn't really matter in checkfds, don't bother to check it on AIX and Solaris. Fixes #61584 Change-Id: I4e679ee3fdad4f0b833ae102597b2d6b8cb46cb6 Reviewed-on: https://go-review.googlesource.com/c/go/+/513215 Run-TryBot: Ian Lance Taylor Reviewed-by: Ian Lance Taylor TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Reviewed-by: Roland Shoemaker Run-TryBot: Ian Lance Taylor --- diff --git a/src/runtime/fds_unix.go b/src/runtime/fds_unix.go index 3004e6fd8b..f39e6a49e9 100644 --- a/src/runtime/fds_unix.go +++ b/src/runtime/fds_unix.go @@ -28,6 +28,16 @@ func checkfds() { if ret >= 0 { continue } + + // On AIX and Solaris we can't get the right errno + // value this early in program startup, + // because we haven't yet called minit + // which sets m.mOS.perrno. + // Just assume that the error is EBADF. + if GOOS == "aix" || GOOS == "solaris" { + errno = EBADF + } + if errno != EBADF { print("runtime: unexpected error while checking standard file descriptor ", i, ", errno=", errno, "\n") throw("cannot open standard fds")