summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2023-11-17 11:42:19 +0100
committerBenBE <BenBE@geshi.org>2023-11-19 22:06:18 +0100
commite49a40ad82c7ce122f30b0056a2fc2cdb1a208b0 (patch)
treed62ea693324ad4ca10140e1756792569e8ebd36e
parent0875b9e04264c0deb60c98c2585f54bb573e4731 (diff)
Shorten podman/libpod container IDs to 12 characters
-rw-r--r--linux/CGroupUtils.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/linux/CGroupUtils.c b/linux/CGroupUtils.c
index e8d5f1de..aa88201a 100644
--- a/linux/CGroupUtils.c
+++ b/linux/CGroupUtils.c
@@ -78,6 +78,7 @@ static bool CGroup_filterName_internal(const char* cgroup, StrBuf_state* s, StrB
const char* str_nspawn_payload_label = "/payload";
const char* str_snap_scope_prefix = "snap.";
+ const char* str_pod_scope_prefix = "libpod-";
const char* str_service_suffix = ".service";
const char* str_scope_suffix = ".scope";
@@ -291,6 +292,23 @@ static bool CGroup_filterName_internal(const char* cgroup, StrBuf_state* s, StrB
cgroup = nextSlash;
continue;
+ } else if (Label_checkPrefix(labelStart, scopeNameLen, str_pod_scope_prefix)) {
+ const char* nextDot = String_strchrnul(labelStart + strlen(str_pod_scope_prefix), '.');
+
+ if (!StrBuf_putsz(s, w, "!pod:"))
+ return false;
+
+ if (nextDot >= labelStart + scopeNameLen) {
+ nextDot = labelStart + scopeNameLen;
+ }
+
+ if (!StrBuf_putsn(s, w, labelStart + strlen(str_pod_scope_prefix),
+ MINIMUM( nextDot - (labelStart + strlen(str_pod_scope_prefix)), 12)))
+ return false;
+
+ cgroup = nextSlash;
+
+ continue;
}
if (!w(s, '!'))

© 2014-2024 Faster IT GmbH | imprint | privacy policy