594167
From f2ca27c7fa3e98cbb412871d7ea18b51e7f5f048 Mon Sep 17 00:00:00 2001
594167
From: Yu Watanabe <watanabe.yu+github@gmail.com>
594167
Date: Sun, 17 Apr 2022 07:29:24 +0900
594167
Subject: [PATCH] sd-bus: do not return negative errno when unknown name is
594167
 specified
594167
594167
When 'recursive' is false, then sd_bus_track_remove_name() does not
594167
return negative errno when unknown name is specified. Let's follow the
594167
same pattern for the case that 'recursive' is true.
594167
594167
(cherry picked from commit 55bfacc6c33eaf3475762e71172b2ef504be5af8)
594167
594167
Related: #2087652
594167
---
594167
 src/libsystemd/sd-bus/bus-track.c | 5 +----
594167
 1 file changed, 1 insertion(+), 4 deletions(-)
594167
594167
diff --git a/src/libsystemd/sd-bus/bus-track.c b/src/libsystemd/sd-bus/bus-track.c
594167
index 1cbdb46f4c..c56bd03fc6 100644
594167
--- a/src/libsystemd/sd-bus/bus-track.c
594167
+++ b/src/libsystemd/sd-bus/bus-track.c
594167
@@ -256,12 +256,9 @@ _public_ int sd_bus_track_remove_name(sd_bus_track *track, const char *name) {
594167
         if (!track) /* Treat a NULL track object as an empty track object */
594167
                 return 0;
594167
 
594167
-        if (!track->recursive)
594167
-                return bus_track_remove_name_fully(track, name);
594167
-
594167
         i = hashmap_get(track->names, name);
594167
         if (!i)
594167
-                return -EUNATCH;
594167
+                return 0;
594167
 
594167
         assert(i->n_ref >= 1);
594167
         if (i->n_ref <= 1)