summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-05-17 02:22:37 +0200
committerLennart Poettering <lennart@poettering.net>2013-05-17 04:26:27 +0200
commitf54514f3542db9b1f1a6f7546472718ce0d02aae (patch)
tree5aca2b916d9d91f87b60b8ec57035f7d53900593 /src/libsystemd-bus/bus-message.c
parent8fd57568e6e82aafe153ec1f34cca36c9ccee455 (diff)
bus: keep kernel bus fd around during entire life-time of bus
We need this since we might need to invoke the release ioctl for messages. Since we don't want to add any locking for that we simply keep a reference to the bus and then rely that the fd stays valid all the time.
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r--src/libsystemd-bus/bus-message.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index c72b52d546..e531dec5cd 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -128,14 +128,14 @@ static void message_free(sd_bus_message *m) {
if (m->release_kdbus)
ioctl(m->bus->input_fd, KDBUS_CMD_MSG_RELEASE, m->kdbus);
+ if (m->bus)
+ sd_bus_unref(m->bus);
+
if (m->free_fds) {
close_many(m->fds, m->n_fds);
free(m->fds);
}
- if (m->bus)
- sd_bus_unref(m->bus);
-
if (m->iovec != m->iovec_fixed)
free(m->iovec);