summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-message.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-24 23:55:03 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-25 02:33:35 +0100
commit021a1e78d7621bcd844a9bf22efca88960a8e28b (patch)
treeddcdf2436d4ba4d1c8a59d0e91db7fdd27db35cb /src/libsystemd-bus/bus-message.c
parent66f931b4c818a5f9f7f36b2a0f3b0422609a6e8d (diff)
bus: make optional whether unix socket passing is negotiated and whether hello is sent
This alos gets rid of explicit sd_open_fd() and sd_open_address() constructors in favour of sd_new() + sd_new_start() where the negotiation parameters may be set it in between.
Diffstat (limited to 'src/libsystemd-bus/bus-message.c')
-rw-r--r--src/libsystemd-bus/bus-message.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 22e6404209..416eedc2ae 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -331,7 +331,7 @@ static sd_bus_message *message_new(sd_bus *bus, uint8_t type) {
m->header->endian = SD_BUS_NATIVE_ENDIAN;
m->header->type = type;
m->header->version = bus ? bus->message_version : 1;
- m->allow_fds = !bus || bus->can_fds;
+ m->allow_fds = !bus || bus->can_fds || (bus->state != BUS_HELLO && bus->state != BUS_RUNNING);
return m;
}
@@ -354,6 +354,8 @@ int sd_bus_message_new_signal(
return -EINVAL;
if (!m)
return -EINVAL;
+ if (bus && bus->state == BUS_UNSET)
+ return -ENOTCONN;
t = message_new(bus, SD_BUS_MESSAGE_TYPE_SIGNAL);
if (!t)
@@ -396,6 +398,8 @@ int sd_bus_message_new_method_call(
return -EINVAL;
if (!m)
return -EINVAL;
+ if (bus && bus->state == BUS_UNSET)
+ return -ENOTCONN;
t = message_new(bus, SD_BUS_MESSAGE_TYPE_METHOD_CALL);
if (!t)
@@ -445,6 +449,8 @@ static int message_new_reply(
return -EINVAL;
if (!m)
return -EINVAL;
+ if (bus && bus->state == BUS_UNSET)
+ return -ENOTCONN;
t = message_new(bus, type);
if (!t)