From 9b2f1e6fb659704bc58927454499f33dccdb48de Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 23 Mar 2021 16:06:03 -0700 Subject: [PATCH] runc version: don't use seccomp.IsEnabled As pointed out to in [1], seccomp.IsEnabled does some runtime checks, while here (when printing libseccomp version) we should merely print the version number of libseccomp, if compiled in. Change the code to check if the version is non-zero (as seccomp.Version returns 0, 0, 0 in case seccomp is not compiled in. [1] https://github.com/opencontainers/runc/pull/2866 Signed-off-by: Kir Kolyshkin --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 57d7f4282..1bddcc434 100644 --- a/main.go +++ b/main.go @@ -64,8 +64,9 @@ func main() { } v = append(v, "spec: "+specs.Version) v = append(v, "go: "+runtime.Version()) - if seccomp.IsEnabled() { - major, minor, micro := seccomp.Version() + + major, minor, micro := seccomp.Version() + if major+minor+micro > 0 { v = append(v, fmt.Sprintf("libseccomp: %d.%d.%d", major, minor, micro)) } app.Version = strings.Join(v, "\n")