chiark / gitweb /
sd-bus: fix path of object-manager signals
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 21 Jul 2015 10:59:56 +0000 (12:59 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:07:02 +0000 (10:07 +0100)
commit31b940441e3c62fcdba8943307955df357cce085
tree8a9da4f8d33015c6765478b034daceeb49f9a88a
parent6609ed3a939c2feb8a7cd39ce4f45413f2d58315
sd-bus: fix path of object-manager signals

Each signal of the ObjectManager interface carries the path of the object
in question as an argument. Therefore, a caller will deduce the object
this signal is generated for, by parsing the _argument_. A caller will
*not* use the object-path of the message itself (i.e., message->path).
This is done on purpose, so the caller can rely on message->path to be
the path of the actual object-manager that generated this signal, instead
of the path of the object that triggered this signal.

This commit fixes all InterfacesAdded/Removed signals to use the path of
the closest object-manager as message->path. 'closest' in this case means
closest parent with at least one object-manager registered.

This fix raises the question what happens if we stack object-managers in
a hierarchy. Two implementations are possible: First, we report each
object only on the nearest object-manager. Second, we report it on each
parent object-manager. This patch chooses the former. This is compatible
with other existing ObjectManager implementations, which are required to
call GetManagedObjects() recursively on each object they find, which
implements the ObjectManager interface.
src/libelogind/sd-bus/bus-objects.c
src/libelogind/sd-bus/test-bus-objects.c