Skip to content
This repository was archived by the owner on Apr 21, 2021. It is now read-only.

Commit 0451545

Browse files
committed
validate: allow non-linux compatibility
Signed-off-by: Vincent Batts <[email protected]>
1 parent efbda7d commit 0451545

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

validate/validate.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -862,17 +862,6 @@ func CapValid(c string, hostSpecific bool) error {
862862
return nil
863863
}
864864

865-
// LastCap return last cap of system
866-
func LastCap() capability.Cap {
867-
last := capability.CAP_LAST_CAP
868-
// hack for RHEL6 which has no /proc/sys/kernel/cap_last_cap
869-
if last == capability.Cap(63) {
870-
last = capability.CAP_BLOCK_SUSPEND
871-
}
872-
873-
return last
874-
}
875-
876865
func envValid(env string) bool {
877866
items := strings.Split(env, "=")
878867
if len(items) < 2 {

validate/validate_linux.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// +build linux
2+
3+
package validate
4+
5+
import (
6+
"github.com/syndtr/gocapability/capability"
7+
)
8+
9+
// LastCap return last cap of system
10+
func LastCap() capability.Cap {
11+
last := capability.CAP_LAST_CAP
12+
// hack for RHEL6 which has no /proc/sys/kernel/cap_last_cap
13+
if last == capability.Cap(63) {
14+
last = capability.CAP_BLOCK_SUSPEND
15+
}
16+
17+
return last
18+
}

validate/validate_unsupported.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// +build !linux
2+
3+
package validate
4+
5+
import (
6+
"github.com/syndtr/gocapability/capability"
7+
)
8+
9+
// LastCap return last cap of system
10+
func LastCap() capability.Cap {
11+
return capability.Cap(-1)
12+
}

0 commit comments

Comments
 (0)