diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-03-20 22:56:25 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-03-20 23:00:10 +0100 |
commit | 89ffcd2ad5bf87866314e96c4179ba622851cd6e (patch) | |
tree | b6415892e9160fbf11a95244617d69992d024026 /src/libsystemd-bus/bus-error.c | |
parent | fbfa72b0a1276366d50dce223c06efe9db9d6585 (diff) |
bus: hook up client with socket communication
Diffstat (limited to 'src/libsystemd-bus/bus-error.c')
-rw-r--r-- | src/libsystemd-bus/bus-error.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/libsystemd-bus/bus-error.c b/src/libsystemd-bus/bus-error.c index 015fae70ad..f86da624fd 100644 --- a/src/libsystemd-bus/bus-error.c +++ b/src/libsystemd-bus/bus-error.c @@ -86,6 +86,8 @@ int sd_bus_error_set(sd_bus_error *e, const char *name, const char *format, ...) } int sd_bus_error_copy(sd_bus_error *dest, const sd_bus_error *e) { + char *x, *y = NULL; + if (!dest) return 0; if (bus_error_is_dirty(dest)) @@ -93,27 +95,21 @@ int sd_bus_error_copy(sd_bus_error *dest, const sd_bus_error *e) { if (!sd_bus_error_is_set(e)) return 0; - if (e->need_free) { - char *x, *y = NULL; + x = strdup(e->name); + if (!x) + return -ENOMEM; - x = strdup(e->name); - if (!x) + if (e->message) { + y = strdup(e->message); + if (!y) { + free(x); return -ENOMEM; - - if (e->message) { - y = strdup(e->message); - if (!y) { - free(x); - return -ENOMEM; - } } + } - dest->name = x; - dest->message = y; - dest->need_free = true; - } else - *dest = *e; - + dest->name = x; + dest->message = y; + dest->need_free = true; return 0; } |