diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2024-04-28 16:27:06 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2024-05-14 16:12:20 +0200 |
commit | 00f1714311c38ff1de6bbb96a33cc6448920bce2 (patch) | |
tree | c86a6a423c872d9ec941d2b55176d8ec037e6f83 /src/core/cgroup.c | |
parent | libsystemd-network: skip dhcp server test in case of EAFNOSUPPORT (diff) | |
download | systemd-00f1714311c38ff1de6bbb96a33cc6448920bce2.tar.xz systemd-00f1714311c38ff1de6bbb96a33cc6448920bce2.zip |
cgroup-util: allow cg_read_pid() to skip unmapped (zero) pids
Diffstat (limited to 'src/core/cgroup.c')
-rw-r--r-- | src/core/cgroup.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 324da95a43..34fd2a250c 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -3627,7 +3627,9 @@ int unit_search_main_pid(Unit *u, PidRef *ret) { for (;;) { _cleanup_(pidref_done) PidRef npidref = PIDREF_NULL; - r = cg_read_pidref(f, &npidref); + /* cg_read_pidref() will return an error on unmapped PIDs. + * We can't reasonably deal with units that contain those. */ + r = cg_read_pidref(f, &npidref, CGROUP_DONT_SKIP_UNMAPPED); if (r < 0) return r; if (r == 0) @@ -3669,7 +3671,7 @@ static int unit_watch_pids_in_path(Unit *u, const char *path) { for (;;) { _cleanup_(pidref_done) PidRef pid = PIDREF_NULL; - r = cg_read_pidref(f, &pid); + r = cg_read_pidref(f, &pid, /* flags = */ 0); if (r == 0) break; if (r < 0) { |