summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-bus/bus-error.c3
-rw-r--r--src/libsystemd-bus/bus-kernel.c12
-rw-r--r--src/libsystemd-bus/bus-message.c12
-rw-r--r--src/libsystemd-bus/bus-signature.c13
4 files changed, 29 insertions, 11 deletions
diff --git a/src/libsystemd-bus/bus-error.c b/src/libsystemd-bus/bus-error.c
index 4f18629758..25eaf0eee4 100644
--- a/src/libsystemd-bus/bus-error.c
+++ b/src/libsystemd-bus/bus-error.c
@@ -39,7 +39,8 @@ static int bus_error_name_to_errno(const char *name) {
const char *p;
int r;
- assert_return(name, EINVAL);
+ if (!name)
+ return EINVAL;
p = startswith(name, "System.Error.");
if (p) {
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);
diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c
index 5e355127b0..9e712717cc 100644
--- a/src/libsystemd-bus/bus-message.c
+++ b/src/libsystemd-bus/bus-message.c
@@ -161,7 +161,9 @@ static void *message_extend_fields(sd_bus_message *m, size_t align, size_t sz, b
size_t old_size, new_size, start;
assert(m);
- assert_return(!m->poisoned, NULL);
+
+ if (m->poisoned)
+ return NULL;
old_size = sizeof(struct bus_header) + m->header->fields_size;
start = ALIGN_TO(old_size, align);
@@ -987,7 +989,9 @@ struct bus_body_part *message_append_part(sd_bus_message *m) {
struct bus_body_part *part;
assert(m);
- assert_return(!m->poisoned, NULL);
+
+ if (m->poisoned)
+ return NULL;
if (m->n_body_parts <= 0) {
part = &m->body;
@@ -1134,7 +1138,9 @@ static void *message_extend_body(sd_bus_message *m, size_t align, size_t sz, boo
assert(m);
assert(align > 0);
assert(!m->sealed);
- assert_return(!m->poisoned, NULL);
+
+ if (m->poisoned)
+ return NULL;
start_body = ALIGN_TO((size_t) m->header->body_size, align);
end_body = start_body + sz;
diff --git a/src/libsystemd-bus/bus-signature.c b/src/libsystemd-bus/bus-signature.c
index 3fb07943d7..1e5bf4821d 100644
--- a/src/libsystemd-bus/bus-signature.c
+++ b/src/libsystemd-bus/bus-signature.c
@@ -33,7 +33,9 @@ static int signature_element_length_internal(
int r;
- assert_return(s, -EINVAL);
+ if (!s)
+ return -EINVAL;
+
assert(l);
if (bus_type_is_basic(*s) || *s == SD_BUS_TYPE_VARIANT) {
@@ -115,7 +117,8 @@ bool signature_is_single(const char *s, bool allow_dict_entry) {
int r;
size_t t;
- assert_return(s, false);
+ if (!s)
+ return false;
r = signature_element_length_internal(s, allow_dict_entry, 0, 0, &t);
if (r < 0)
@@ -126,7 +129,8 @@ bool signature_is_single(const char *s, bool allow_dict_entry) {
bool signature_is_pair(const char *s) {
- assert_return(s, false);
+ if (!s)
+ return false;
if (!bus_type_is_basic(*s))
return false;
@@ -138,7 +142,8 @@ bool signature_is_valid(const char *s, bool allow_dict_entry) {
const char *p;
int r;
- assert_return(s, false);
+ if (!s)
+ return false;
p = s;
while (*p) {