diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-06-27 15:14:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 15:14:20 +0000 |
commit | 088665d2cfd488004f34dbd0804c3cd00bf94ca4 (patch) | |
tree | 0aa7d04edc4009672fcc760aca511b8d10796682 /vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go | |
parent | 8806606ca2e2060750b3f86c6d31bb50125309de (diff) | |
parent | 2792e598c7ce1198ec8464a3119504123ae8397c (diff) | |
download | podman-088665d2cfd488004f34dbd0804c3cd00bf94ca4.tar.gz podman-088665d2cfd488004f34dbd0804c3cd00bf94ca4.tar.bz2 podman-088665d2cfd488004f34dbd0804c3cd00bf94ca4.zip |
Merge pull request #14654 from cdoern/cgroup
podman cgroup enhancement
Diffstat (limited to 'vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go')
-rw-r--r-- | vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go index 6b9fc3435..dbd435341 100644 --- a/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go +++ b/vendor/github.com/opencontainers/runc/libcontainer/utils/utils.go @@ -132,19 +132,16 @@ func WithProcfd(root, unsafePath string, fn func(procfd string) error) error { return fn(procfd) } -// SearchLabels searches a list of key-value pairs for the provided key and -// returns the corresponding value. The pairs must be separated with '='. -func SearchLabels(labels []string, query string) string { - for _, l := range labels { - parts := strings.SplitN(l, "=", 2) - if len(parts) < 2 { - continue - } - if parts[0] == query { - return parts[1] +// SearchLabels searches through a list of key=value pairs for a given key, +// returning its value, and the binary flag telling whether the key exist. +func SearchLabels(labels []string, key string) (string, bool) { + key += "=" + for _, s := range labels { + if strings.HasPrefix(s, key) { + return s[len(key):], true } } - return "" + return "", false } // Annotations returns the bundle path and user defined annotations from the |