[systemd-commits] 2 commits - configure.ac src/libsystemd-bus

Lennart Poettering lennart at kemper.freedesktop.org
Fri Nov 29 04:35:04 PST 2013


 configure.ac                     |    1 +
 src/libsystemd-bus/bus-message.c |   14 +++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

New commits:
commit 5461f53f186d4253c690df8d1ae06710e0d17585
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Nov 29 13:34:16 2013 +0100

    bus: when turning a buffer into a sd_bus_message avoid creating zero-length parts

diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index dd058e7..920488d 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -385,6 +385,7 @@ int bus_message_from_malloc(
                 sd_bus_message **ret) {
 
         sd_bus_message *m;
+        size_t sz;
         int r;
 
         r = bus_message_from_header(bus, buffer, length, fds, n_fds, ucred, label, 0, &m);
@@ -396,11 +397,14 @@ int bus_message_from_malloc(
                 goto fail;
         }
 
-        m->n_body_parts = 1;
-        m->body.data = (uint8_t*) buffer + sizeof(struct bus_header) + ALIGN8(BUS_MESSAGE_FIELDS_SIZE(m));
-        m->body.size = length - sizeof(struct bus_header) - ALIGN8(BUS_MESSAGE_FIELDS_SIZE(m));
-        m->body.sealed = true;
-        m->body.memfd = -1;
+        sz = length - sizeof(struct bus_header) - ALIGN8(BUS_MESSAGE_FIELDS_SIZE(m));
+        if (sz > 0) {
+                m->n_body_parts = 1;
+                m->body.data = (uint8_t*) buffer + sizeof(struct bus_header) + ALIGN8(BUS_MESSAGE_FIELDS_SIZE(m));
+                m->body.size = sz;
+                m->body.sealed = true;
+                m->body.memfd = -1;
+        }
 
         m->n_iovec = 1;
         m->iovec = m->iovec_fixed;

commit 03930e48636e86ad84946253ca2bf4f91deeb645
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Nov 29 02:09:58 2013 +0100

    Revert "build-sys: avoid warnings from assert_cc"
    
    This reverts commit f1a1264d13b31b9f5521f482d9a5a9d78da55efb.
    
    We can turn this off with a pragma only on old gcc. Newer gcc doesn't
    need this, so let's not turn this off for everybody.

diff --git a/configure.ac b/configure.ac
index db9440d..6995e78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,7 @@ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
         -Wold-style-definition \
         -Wpointer-arith \
         -Winit-self \
+        -Wdeclaration-after-statement \
         -Wfloat-equal \
         -Wmissing-prototypes \
         -Wstrict-prototypes \



More information about the systemd-commits mailing list