1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-03 01:17:45 +03:00

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.

(cherry picked from commit bdff06de06)
This commit is contained in:
Sebastian Scheibner 2020-05-22 10:37:43 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 6c7b91372d
commit 175ba30cf6

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