From 66f83537f935b41e2c2e097eee72b5db25dc9716 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Fri, 11 Apr 2025 23:43:25 +0200 Subject: [PATCH] core: unit_watch_pidref() gracefully handles EEXIST No need to check that at callsite. --- src/core/dbus-manager.c | 2 +- src/core/dbus-scope.c | 4 ++-- src/core/scope.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 9e7aba67517..8addce3d102 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -2947,7 +2947,7 @@ static int aux_scope_from_message(Manager *m, sd_bus_message *message, Unit **re return r; r = unit_watch_pidref(scope, p, /* exclusive= */ false); - if (r < 0 && r != -EEXIST) + if (r < 0) return r; } diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c index 15c3595a42b..f3beee92e70 100644 --- a/src/core/dbus-scope.c +++ b/src/core/dbus-scope.c @@ -125,7 +125,7 @@ static int bus_scope_set_transient_property( if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = unit_watch_pidref(u, p, /* exclusive= */ false); - if (r < 0 && r != -EEXIST) + if (r < 0) return r; } @@ -166,7 +166,7 @@ static int bus_scope_set_transient_property( if (!UNIT_WRITE_FLAGS_NOOP(flags)) { r = unit_watch_pidref(u, &pidref, /* exclusive= */ false); - if (r < 0 && r != -EEXIST) + if (r < 0) return r; } diff --git a/src/core/scope.c b/src/core/scope.c index 9e14b78da27..40fb41e541a 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -239,7 +239,7 @@ static int scope_coldplug(Unit *u) { PidRef *pid; SET_FOREACH(pid, u->pids) { r = unit_watch_pidref(u, pid, /* exclusive= */ false); - if (r < 0 && r != -EEXIST) + if (r < 0) return r; } } -- 2.47.3