From f17153a721d6242c0da3ce78163cd7f12b75989f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 19 May 2020 09:04:03 +0200 Subject: busctl: improve error messages on duplicate members/interfaces Prompted by: #15833 --- src/busctl/busctl.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/busctl') 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; -- cgit v1.2.3