diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-05-19 09:04:03 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-05-19 09:11:15 +0200 |
commit | f17153a721d6242c0da3ce78163cd7f12b75989f (patch) | |
tree | 881db1ab6778d9e2d9e60dd26849428f712a0b16 /src/busctl | |
parent | busctl: use structured initialization (diff) | |
download | systemd-f17153a721d6242c0da3ce78163cd7f12b75989f.tar.xz systemd-f17153a721d6242c0da3ce78163cd7f12b75989f.zip |
busctl: improve error messages on duplicate members/interfaces
Prompted by: #15833
Diffstat (limited to 'src/busctl')
-rw-r--r-- | src/busctl/busctl.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c index ca92b4ea24..7aceb1796f 100644 --- a/src/busctl/busctl.c +++ b/src/busctl/busctl.c @@ -870,8 +870,10 @@ static int on_interface(const char *interface, uint64_t flags, void *userdata) { return log_oom(); r = set_put(members, m); - if (r <= 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Duplicate interface"); + if (r == -EEXIST) + return log_error_errno(r, "Invalid introspection data: duplicate interface '%s'.", interface); + if (r < 0) + return log_oom(); m = NULL; return 0; @@ -911,8 +913,10 @@ static int on_method(const char *interface, const char *name, const char *signat return log_oom(); r = set_put(members, m); - if (r <= 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Duplicate method"); + if (r == -EEXIST) + return log_error_errno(r, "Invalid introspection data: duplicate method '%s' on interface '%s'.", name, interface); + if (r < 0) + return log_oom(); m = NULL; return 0; @@ -948,8 +952,10 @@ static int on_signal(const char *interface, const char *name, const char *signat return log_oom(); r = set_put(members, m); - if (r <= 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Duplicate signal"); + if (r == -EEXIST) + return log_error_errno(r, "Invalid introspection data: duplicate signal '%s' on interface '%s'.", name, interface); + if (r < 0) + return log_oom(); m = NULL; return 0; @@ -986,8 +992,10 @@ static int on_property(const char *interface, const char *name, const char *sign return log_oom(); r = set_put(members, m); - if (r <= 0) - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Duplicate property"); + if (r == -EEXIST) + return log_error_errno(r, "Invalid introspection data: duplicate property '%s' on interface '%s'.", name, interface); + if (r < 0) + return log_oom(); m = NULL; return 0; |