From: Meng Zhuo Date: Thu, 6 Jun 2019 11:17:01 +0000 (+0800) Subject: syscall: fix skip condition in skipUnprivilegedUserClone X-Git-Tag: go1.13beta1~132 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5ec14065dcc4c066ca7e434be7239c942f0c2e5b;p=gostls13.git syscall: fix skip condition in skipUnprivilegedUserClone This is a follow up CL of CL 180877: It will skip test create user namespaces under 3 conditions: 1. sysctl file is missing 2. file reads nothing 3. user don't have permission to create namespaces Change-Id: I25f00a6b67213bf98d654972388637789978e1fe Reviewed-on: https://go-review.googlesource.com/c/go/+/180937 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Tobias Klauser --- diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go index 8759775fcc..cc2140f811 100644 --- a/src/syscall/exec_linux_test.go +++ b/src/syscall/exec_linux_test.go @@ -46,7 +46,7 @@ func skipUnprivilegedUserClone(t *testing.T) { // Skip the test if the sysctl that prevents unprivileged user // from creating user namespaces is enabled. data, errRead := ioutil.ReadFile("/proc/sys/kernel/unprivileged_userns_clone") - if errRead != nil || len(data) < 1 && data[0] == '0' { + if errRead != nil || len(data) < 1 || data[0] == '0' { t.Skip("kernel prohibits user namespace in unprivileged process") } }