busctl: Fix warning about invaild introspection data

The set_put function returns 0 if the element is already in the set and
not EEXIST, like e.g. hashmap does.
This commit is contained in:
Sebastian Scheibner
2020-05-22 10:37:43 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent bc33789a06
commit bdff06de06

View 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();