diff options
author | Benny Baumann <BenBE@geshi.org> | 2022-02-27 20:57:05 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2022-03-06 19:56:25 +0100 |
commit | 23b56193d7e8fd01b755c2dd269a19a5de2cc68d (patch) | |
tree | e9e8b285725f89060b48d8c4b5dc6b91f64eee90 /linux | |
parent | edf319e53d1fb77546505e238d75160a3febe56e (diff) |
Reduce column width spam by snapd
Diffstat (limited to 'linux')
-rw-r--r-- | linux/CGroupUtils.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/linux/CGroupUtils.c b/linux/CGroupUtils.c index 765012d3..d6d2ae8f 100644 --- a/linux/CGroupUtils.c +++ b/linux/CGroupUtils.c @@ -76,6 +76,8 @@ static bool CGroup_filterName_internal(const char *cgroup, StrBuf_state* s, StrB const char* str_nspawn_monitor_label = "/supervisor"; const char* str_nspawn_payload_label = "/payload"; + const char* str_snap_scope_prefix = "snap."; + const char* str_service_suffix = ".service"; const char* str_scope_suffix = ".scope"; @@ -267,6 +269,22 @@ static bool CGroup_filterName_internal(const char *cgroup, StrBuf_state* s, StrB cgroup += strlen(str_nspawn_payload_label); continue; + } else if(Label_checkPrefix(labelStart, scopeNameLen, str_snap_scope_prefix)) { + const char* nextDot = strchrnul(labelStart + strlen(str_snap_scope_prefix), '.'); + + if (!StrBuf_putsz(s, w, "!snap:")) + return false; + + if (nextDot >= labelStart + scopeNameLen) { + nextDot = labelStart + scopeNameLen; + } + + if (!StrBuf_putsn(s, w, labelStart + strlen(str_snap_scope_prefix), nextDot - (labelStart + strlen(str_snap_scope_prefix)))) + return false; + + cgroup = nextSlash; + + continue; } if (!w(s, '!')) |