Currently running the test-kdbus-activator test will fail with -EINVAL

To fix this, remove the redundant offsetof() macros since it is already
handled. The KDBUS_ITEM_SIZE() will expand into KDBUS_ITEM_HEADER_SIZE()
which expands into an offsetof() one.

Signed-off-by: Djalal Harouni <[email protected]>
---
 test/kdbus-util.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/test/kdbus-util.c b/test/kdbus-util.c
index 5316263..7a6f272 100644
--- a/test/kdbus-util.c
+++ b/test/kdbus-util.c
@@ -117,20 +117,19 @@ kdbus_hello_registrar(const char *path, const char *name,
        struct kdbus_item *item, *items;
        size_t i, size;
 
-       size = KDBUS_ITEM_SIZE(offsetof(struct kdbus_item, str) + strlen(name) 
+ 1)
-               + num_access * KDBUS_ITEM_SIZE(offsetof(struct kdbus_item, 
policy_access) +
-                                              sizeof(struct 
kdbus_policy_access));
+       size = KDBUS_ITEM_SIZE(strlen(name) + 1)
+               + num_access * KDBUS_ITEM_SIZE(sizeof(struct 
kdbus_policy_access));
 
        items = alloca(size);
 
        item = items;
-       item->size = offsetof(struct kdbus_item, str) + strlen(name) + 1;
+       item->size = KDBUS_ITEM_HEADER_SIZE + strlen(name) + 1;
        item->type = KDBUS_ITEM_NAME;
        strcpy(item->str, name);
        item = KDBUS_ITEM_NEXT(item);
 
        for (i = 0; i < num_access; i++) {
-               item->size = offsetof(struct kdbus_item, policy_access) +
+               item->size = KDBUS_ITEM_HEADER_SIZE +
                             sizeof(struct kdbus_policy_access);
                item->type = KDBUS_ITEM_POLICY_ACCESS;
 
-- 
1.9.0

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to