diff options
author | Lukasz Skalski <l.skalski@partner.samsung.com> | 2013-12-09 14:09:25 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-12-09 23:27:19 -0500 |
commit | f7e2bd5a8070ba86cba6bcbf7d1c9a8173d846d4 (patch) | |
tree | dcb3ed2b03e2d98a663adadc52a1de6c09e50d76 /src/libsystemd-bus/bus-kernel.c | |
parent | d838db0d3b1369639ed7572f4f838eda58b8d858 (diff) |
libsystemd-bus: use assert_return
Diffstat (limited to 'src/libsystemd-bus/bus-kernel.c')
-rw-r--r-- | src/libsystemd-bus/bus-kernel.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c index d0a9fbc3fb..0f38b660a5 100644 --- a/src/libsystemd-bus/bus-kernel.c +++ b/src/libsystemd-bus/bus-kernel.c @@ -321,9 +321,7 @@ int bus_kernel_take_fd(sd_bus *b) { int r; assert(b); - - if (b->is_server) - return -EINVAL; + assert_return(!b->is_server, -EINVAL); b->use_memfd = 1; @@ -375,9 +373,7 @@ int bus_kernel_connect(sd_bus *b) { assert(b->input_fd < 0); assert(b->output_fd < 0); assert(b->kernel); - - if (b->is_server) - return -EINVAL; + assert_return(!b->is_server, -EINVAL); b->input_fd = open(b->kernel, O_RDWR|O_NOCTTY|O_CLOEXEC); if (b->input_fd < 0) @@ -918,9 +914,7 @@ int bus_kernel_pop_memfd(sd_bus *bus, void **address, size_t *size) { assert(address); assert(size); - - if (!bus || !bus->is_kernel) - return -ENOTSUP; + assert_return(bus && bus->is_kernel, -ENOTSUP); assert_se(pthread_mutex_lock(&bus->memfd_cache_mutex) >= 0); |