mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
037ac2bd84
commit
5ec14065dc
1 changed files with 1 additions and 1 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue