diff options
author | Meng Zhuo <mengzhuo1203@gmail.com> | 2019-06-06 19:17:01 +0800 |
---|---|---|
committer | Tobias Klauser <tobias.klauser@gmail.com> | 2019-06-06 11:40:17 +0000 |
commit | 5ec14065dcc4c066ca7e434be7239c942f0c2e5b (patch) | |
tree | 5518d7d5a15c3ee2e60a0676f3a71ad2d22937f6 | |
parent | 037ac2bd84480e0a06c4d1e7a2c1f133109466a5 (diff) | |
download | go-5ec14065dcc4c066ca7e434be7239c942f0c2e5b.tar.gz go-5ec14065dcc4c066ca7e434be7239c942f0c2e5b.zip |
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 <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
-rw-r--r-- | src/syscall/exec_linux_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
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") } } |