1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-12 21:57:27 +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 bdff06de069fc83f18a126bf6b899ae2341572c3)
(cherry picked from commit 175ba30cf64772b136b5b982f04ff3c9a8295e23)
This commit is contained in:
Sebastian Scheibner 2020-05-22 10:37:43 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 7831972971
commit 6fd508a3ae

View File

@ -808,8 +808,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();
@ -851,8 +852,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();
@ -890,8 +892,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();
@ -930,8 +933,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();