diff --git a/legacy/edbus/src/lib/edbus_service.c b/legacy/edbus/src/lib/edbus_service.c index cf21a14ecc..109ef602d5 100644 --- a/legacy/edbus/src/lib/edbus_service.c +++ b/legacy/edbus/src/lib/edbus_service.c @@ -356,6 +356,7 @@ cb_introspect(const EDBus_Service_Interface *_iface, const EDBus_Message *messag Eina_Iterator *iterator; EDBus_Service_Interface *iface; EDBus_Service_Object *child; + size_t baselen; if (obj->introspection_data) eina_strbuf_reset(obj->introspection_data); @@ -372,15 +373,15 @@ cb_introspect(const EDBus_Service_Interface *_iface, const EDBus_Message *messag _introspect_append_interface(obj->introspection_data, iface); eina_iterator_free(iterator); + baselen = strlen(obj->path); + /* account for the last '/' */ + if (baselen != 1) + baselen++; + EINA_INLIST_FOREACH(obj->children, child) - { - const char *subpath; - if (strlen(obj->path) == 1) - subpath = child->path+strlen(obj->path); - else - subpath = child->path+strlen(obj->path)+1; - eina_strbuf_append_printf(obj->introspection_data, "", subpath); - } + eina_strbuf_append_printf(obj->introspection_data, + "", + child->path + baselen); eina_strbuf_append(obj->introspection_data, ""); obj->introspection_dirty = EINA_FALSE;