diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-28 16:30:53 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-28 16:30:53 +0100 |
commit | 1797280193ea25a91cc38332c7cee34ba01e7808 (patch) | |
tree | ca9efaf7aa6deda553e62211555f4146bfabbbdf /src/libsystemd/sd-bus/bus-error.c | |
parent | 818eae495ecc1a19d1906bafa6e3a61fe6171f50 (diff) |
sd-bus: make sure %m resolves to the specified error in bus_error_set_errnofv()
Diffstat (limited to 'src/libsystemd/sd-bus/bus-error.c')
-rw-r--r-- | src/libsystemd/sd-bus/bus-error.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c index cfb8d147a7..47f90c26f8 100644 --- a/src/libsystemd/sd-bus/bus-error.c +++ b/src/libsystemd/sd-bus/bus-error.c @@ -444,6 +444,7 @@ _public_ int sd_bus_error_set_errno(sd_bus_error *e, int error) { } int bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_list ap) { + PROTECT_ERRNO; int r; if (error < 0) @@ -477,8 +478,9 @@ int bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_lis if (format) { char *m; - /* First, let's try to fill in the supplied message */ + /* Then, let's try to fill in the supplied message */ + errno = error; /* Make sure that %m resolves to the specified error */ r = vasprintf(&m, format, ap); if (r >= 0) { |