summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-kernel.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-10 19:31:10 +0000
committerLennart Poettering <lennart@poettering.net>2013-12-10 19:31:10 +0000
commit35460afc4896b22b0df743b70003e8768d78111a (patch)
tree8491925a6646e175bb0215676bd05cb169e04cbe /src/libsystemd-bus/bus-kernel.c
parentecad10fe4a4c247da72cafbc7b37f843c7c30c06 (diff)
Revert "libsystemd-bus: use assert_return"
This reverts commit f7e2bd5a8070ba86cba6bcbf7d1c9a8173d846d4. Most of these checks are not programming errors, but happen during normal runtime. For example bus_kernel_pop_memfd() is called all the time on non-kdbus systems and is supposed to quickly fail if kdbus is not available. However, assert_return() makes this failure expensive, and hence has no place here. With the most recent change to assert_return() it will even log a debug message, which should never happen here.
Diffstat (limited to 'src/libsystemd-bus/bus-kernel.c')
-rw-r--r--src/libsystemd-bus/bus-kernel.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 0f38b660a5..d0a9fbc3fb 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -321,7 +321,9 @@ int bus_kernel_take_fd(sd_bus *b) {
int r;
assert(b);
- assert_return(!b->is_server, -EINVAL);
+
+ if (b->is_server)
+ return -EINVAL;
b->use_memfd = 1;
@@ -373,7 +375,9 @@ int bus_kernel_connect(sd_bus *b) {
assert(b->input_fd < 0);
assert(b->output_fd < 0);
assert(b->kernel);
- assert_return(!b->is_server, -EINVAL);
+
+ if (b->is_server)
+ return -EINVAL;
b->input_fd = open(b->kernel, O_RDWR|O_NOCTTY|O_CLOEXEC);
if (b->input_fd < 0)
@@ -914,7 +918,9 @@ int bus_kernel_pop_memfd(sd_bus *bus, void **address, size_t *size) {
assert(address);
assert(size);
- assert_return(bus && bus->is_kernel, -ENOTSUP);
+
+ if (!bus || !bus->is_kernel)
+ return -ENOTSUP;
assert_se(pthread_mutex_lock(&bus->memfd_cache_mutex) >= 0);