]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
busctl: Fix warning about invaild introspection data
authorSebastian Scheibner <asamk@gmx.de>
Fri, 22 May 2020 08:37:43 +0000 (10:37 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 6 Sep 2022 16:00:33 +0000 (18:00 +0200)
The set_put function returns 0 if the element is already in the set and
not EEXIST, like e.g. hashmap does.

src/busctl/busctl.c

index 0f97015bd4b17fbc0aaaa7ff582381ee98949009..c637d084e7925577da5cdc2c7d55df4323132aac 100644 (file)
@@ -809,8 +809,9 @@ static int on_interface(const char *interface, uint64_t flags, void *userdata) {
                 return log_oom();
 
         r = set_put(members, m);
-        if (r == -EEXIST)
-                return log_error_errno(r,  "Invalid introspection data: duplicate interface '%s'.", interface);
+        if (r == 0)
+                return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
+                                       "Invalid introspection data: duplicate interface '%s'.", interface);
         if (r < 0)
                 return log_oom();
 
@@ -852,8 +853,9 @@ static int on_method(const char *interface, const char *name, const char *signat
                 return log_oom();
 
         r = set_put(members, m);
-        if (r == -EEXIST)
-                return log_error_errno(r, "Invalid introspection data: duplicate method '%s' on interface '%s'.", name, interface);
+        if (r == 0)
+                return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
+                                       "Invalid introspection data: duplicate method '%s' on interface '%s'.", name, interface);
         if (r < 0)
                 return log_oom();
 
@@ -891,8 +893,9 @@ static int on_signal(const char *interface, const char *name, const char *signat
                 return log_oom();
 
         r = set_put(members, m);
-        if (r == -EEXIST)
-                return log_error_errno(r, "Invalid introspection data: duplicate signal '%s' on interface '%s'.", name, interface);
+        if (r == 0)
+                return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
+                                       "Invalid introspection data: duplicate signal '%s' on interface '%s'.", name, interface);
         if (r < 0)
                 return log_oom();
 
@@ -931,8 +934,9 @@ static int on_property(const char *interface, const char *name, const char *sign
                 return log_oom();
 
         r = set_put(members, m);
-        if (r == -EEXIST)
-                return log_error_errno(r, "Invalid introspection data: duplicate property '%s' on interface '%s'.", name, interface);
+        if (r == 0)
+                return log_error_errno(SYNTHETIC_ERRNO(EEXIST),
+                                       "Invalid introspection data: duplicate property '%s' on interface '%s'.", name, interface);
         if (r < 0)
                 return log_oom();