File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -102,8 +102,14 @@ func fdRangeFrom(minFd int, fn fdFunc) error {
102102func CloseExecFrom (minFd int ) error {
103103 // Use close_range(CLOSE_RANGE_CLOEXEC) if possible.
104104 if haveCloseRangeCloexec () {
105- err := unix .CloseRange (uint (minFd ), math .MaxUint , unix .CLOSE_RANGE_CLOEXEC )
106- return os .NewSyscallError ("close_range" , err )
105+ err := unix .CloseRange (uint (minFd ), math .MaxInt32 , unix .CLOSE_RANGE_CLOEXEC )
106+ if err == nil {
107+ return nil
108+ }
109+
110+ logrus .Debugf ("close_range failed, closing range one at a time (error: %v)" , err )
111+
112+ // If close_range fails, we fall back to the standard loop.
107113 }
108114 // Otherwise, fall back to the standard loop.
109115 return fdRangeFrom (minFd , unix .CloseOnExec )
You can’t perform that action at this time.
0 commit comments