1
0
mirror of https://github.com/golang/go synced 2024-11-07 13:46:19 -07:00

syscall: update check for UserNS support for CentOS 7.5+

Fixes #26385

Change-Id: I5594564f42898a71d30531e5132bddb3a6915247
GitHub-Last-Rev: fbd7b38b04
GitHub-Pull-Request: golang/go#26427
Reviewed-on: https://go-review.googlesource.com/124555
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
EduRam 2018-07-17 22:59:35 +00:00 committed by Ian Lance Taylor
parent f3cdc94154
commit ce09ce4ae0

View File

@ -84,6 +84,15 @@ func checkUserNS(t *testing.T) {
t.Skip("kernel doesn't support user namespaces")
}
}
// On Centos 7.5+, user namespaces are disabled if user.max_user_namespaces = 0
if _, err := os.Stat("/proc/sys/user/max_user_namespaces"); err == nil {
buf, errRead := ioutil.ReadFile("/proc/sys/user/max_user_namespaces")
if errRead == nil && buf[0] == '0' {
t.Skip("kernel doesn't support user namespaces")
}
}
// When running under the Go continuous build, skip tests for
// now when under Kubernetes. (where things are root but not quite)
// Both of these are our own environment variables.