chiark / gitweb /
bus: rework message handlers to always take an error argument
authorLennart Poettering <lennart@poettering.net>
Thu, 21 Nov 2013 18:34:37 +0000 (19:34 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 21 Nov 2013 20:12:36 +0000 (21:12 +0100)
commitebcf1f97de4f6b1580ae55eb56b1a3939fe6b602
treedef5185990acebac842ed8fca253531d88897a4a
parent0ccad099d4c08dc5a16c87cdd6eefc05e9d4b670
bus: rework message handlers to always take an error argument

Message handler callbacks can be simplified drastically if the
dispatcher automatically replies to method calls if errors are returned.

Thus: add an sd_bus_error argument to all message handlers. When we
dispatch a message handler and it returns negative or a set sd_bus_error
we send this as message error back to the client. This means errors
returned by handlers by default are given back to clients instead of
rippling all the way up to the event loop, which is desirable to make
things robust.

As a side-effect we can now easily turn the SELinux checks into normal
function calls, since the method call dispatcher will generate the right
error replies automatically now.

Also, make sure we always pass the error structure to all property and
method handlers as last argument to follow the usual style of passing
variables for return values as last argument.
42 files changed:
TODO
src/core/dbus-cgroup.c
src/core/dbus-client-track.c
src/core/dbus-execute.c
src/core/dbus-execute.h
src/core/dbus-job.c
src/core/dbus-manager.c
src/core/dbus-mount.c
src/core/dbus-path.c
src/core/dbus-snapshot.c
src/core/dbus-snapshot.h
src/core/dbus-socket.c
src/core/dbus-swap.c
src/core/dbus-timer.c
src/core/dbus-unit.c
src/core/dbus-unit.h
src/core/dbus.c
src/core/selinux-access.c
src/core/selinux-access.h
src/hostname/hostnamed.c
src/libsystemd-bus/bus-match.c
src/libsystemd-bus/bus-message.c
src/libsystemd-bus/bus-objects.c
src/libsystemd-bus/bus-util.c
src/libsystemd-bus/bus-util.h
src/libsystemd-bus/sd-bus.c
src/libsystemd-bus/test-bus-chat.c
src/libsystemd-bus/test-bus-introspect.c
src/libsystemd-bus/test-bus-match.c
src/libsystemd-bus/test-bus-objects.c
src/locale/localed.c
src/login/logind-dbus.c
src/login/logind-seat-dbus.c
src/login/logind-session-dbus.c
src/login/logind-user-dbus.c
src/login/logind.h
src/machine/machine-dbus.c
src/machine/machined-dbus.c
src/machine/machined.h
src/systemctl/systemctl.c
src/systemd/sd-bus.h
src/timedate/timedated.c