[systemd-commits] src/libsystemd

Lennart Poettering lennart at kemper.freedesktop.org
Fri Oct 24 10:28:04 PDT 2014


 src/libsystemd/sd-bus/bus-error.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 455cd8b137b8ef45d04889f2d967c562a097f1e6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Oct 24 19:24:53 2014 +0200

    sd-bus: if we don't manage to properly allocate the error message for an sd_bus_error, just go on
    
    sd_bus_error_setfv() must initialize the sd_bus_error value to some
    sensible value and then return a good errno code matching that. If it
    cannot work at all it should set the error statically to the OOM error.
    But if it can work half-way (i.e. initialize the name, but not the
    message) it should do so and still return the correct errno number for
    it.
    
    This effectively reverts 8bf13eb1e02b9977ae1cd331ae5dc7305a305a09

diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
index 5ca974a..af83c12 100644
--- a/src/libsystemd/sd-bus/bus-error.c
+++ b/src/libsystemd/sd-bus/bus-error.c
@@ -194,13 +194,10 @@ int bus_error_setfv(sd_bus_error *e, const char *name, const char *format, va_li
                 return -ENOMEM;
         }
 
-        if (format) {
-                int r;
-
-                r = vasprintf((char**) &e->message, format, ap);
-                if (r < 0)
-                        return -ENOMEM;
-        }
+        /* Of we hit OOM on formatting the pretty message, we ignore
+         * this, since we at least managed to write the error name */
+        if (format)
+                (void) vasprintf((char**) &e->message, format, ap);
 
         e->_need_free = 1;
 



More information about the systemd-commits mailing list