chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus: always pass valid timeout to kdbus
[elogind.git]
/
src
/
libsystemd-bus
/
bus-message.c
diff --git
a/src/libsystemd-bus/bus-message.c
b/src/libsystemd-bus/bus-message.c
index 5e355127b0cb119f460738c1c9c346a5a3114b97..a86cd9a19677a23b7c97df077395574b656cd6ab 100644
(file)
--- a/
src/libsystemd-bus/bus-message.c
+++ b/
src/libsystemd-bus/bus-message.c
@@
-161,7
+161,9
@@
static void *message_extend_fields(sd_bus_message *m, size_t align, size_t sz, b
size_t old_size, new_size, start;
assert(m);
size_t old_size, new_size, start;
assert(m);
- assert_return(!m->poisoned, NULL);
+
+ if (m->poisoned)
+ return NULL;
old_size = sizeof(struct bus_header) + m->header->fields_size;
start = ALIGN_TO(old_size, align);
old_size = sizeof(struct bus_header) + m->header->fields_size;
start = ALIGN_TO(old_size, align);
@@
-789,7
+791,9
@@
_public_ sd_bus_message* sd_bus_message_ref(sd_bus_message *m) {
}
_public_ sd_bus_message* sd_bus_message_unref(sd_bus_message *m) {
}
_public_ sd_bus_message* sd_bus_message_unref(sd_bus_message *m) {
- assert_return(m, NULL);
+
+ if (!m)
+ return NULL;
assert(m->n_ref > 0);
m->n_ref--;
assert(m->n_ref > 0);
m->n_ref--;
@@
-987,7
+991,9
@@
struct bus_body_part *message_append_part(sd_bus_message *m) {
struct bus_body_part *part;
assert(m);
struct bus_body_part *part;
assert(m);
- assert_return(!m->poisoned, NULL);
+
+ if (m->poisoned)
+ return NULL;
if (m->n_body_parts <= 0) {
part = &m->body;
if (m->n_body_parts <= 0) {
part = &m->body;
@@
-1134,7
+1140,9
@@
static void *message_extend_body(sd_bus_message *m, size_t align, size_t sz, boo
assert(m);
assert(align > 0);
assert(!m->sealed);
assert(m);
assert(align > 0);
assert(!m->sealed);
- assert_return(!m->poisoned, NULL);
+
+ if (m->poisoned)
+ return NULL;
start_body = ALIGN_TO((size_t) m->header->body_size, align);
end_body = start_body + sz;
start_body = ALIGN_TO((size_t) m->header->body_size, align);
end_body = start_body + sz;
@@
-2687,7
+2695,7
@@
static int bus_message_close_header(sd_bus_message *m) {
return 0;
}
return 0;
}
-int bus_message_seal(sd_bus_message *m, uint64_t serial) {
+int bus_message_seal(sd_bus_message *m, uint64_t serial
, usec_t timeout
) {
struct bus_body_part *part;
size_t l, a;
unsigned i;
struct bus_body_part *part;
size_t l, a;
unsigned i;
@@
-2734,6
+2742,7
@@
int bus_message_seal(sd_bus_message *m, uint64_t serial) {
return r;
m->header->serial = serial;
return r;
m->header->serial = serial;
+ m->timeout = m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED ? 0 : timeout;
/* Add padding at the end of the fields part, since we know
* the body needs to start at an 8 byte alignment. We made
/* Add padding at the end of the fields part, since we know
* the body needs to start at an 8 byte alignment. We made