mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 23:20:32 +00:00
Merge pull request #30033 from mrc0mmand/assert_return-tweaks
Dial back a couple of `assert_return()` uses
This commit is contained in:
@@ -1698,8 +1698,8 @@ _public_ int sd_bus_open_system_machine(sd_bus **ret, const char *user_and_machi
|
||||
r = user_and_machine_valid(user_and_machine);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
assert_return(r > 0, -EINVAL);
|
||||
if (r == 0)
|
||||
return -EINVAL;
|
||||
|
||||
r = sd_bus_new(&b);
|
||||
if (r < 0)
|
||||
@@ -1734,8 +1734,8 @@ _public_ int sd_bus_open_user_machine(sd_bus **ret, const char *user_and_machine
|
||||
r = user_and_machine_valid(user_and_machine);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
assert_return(r > 0, -EINVAL);
|
||||
if (r == 0)
|
||||
return -EINVAL;
|
||||
|
||||
r = sd_bus_new(&b);
|
||||
if (r < 0)
|
||||
|
||||
@@ -235,7 +235,8 @@ _public_ int sd_journal_add_match(sd_journal *j, const void *data, size_t size)
|
||||
if (size == 0)
|
||||
size = strlen(data);
|
||||
|
||||
assert_return(match_is_valid(data, size), -EINVAL);
|
||||
if (!match_is_valid(data, size))
|
||||
return -EINVAL;
|
||||
|
||||
/* level 0: AND term
|
||||
* level 1: OR terms
|
||||
|
||||
@@ -975,7 +975,6 @@ static int stop_mounts(
|
||||
}
|
||||
|
||||
static int umount_by_device(sd_bus *bus, sd_device *dev) {
|
||||
_cleanup_(sd_device_unrefp) sd_device *d = NULL;
|
||||
_cleanup_strv_free_ char **list = NULL;
|
||||
const char *v;
|
||||
int r, ret = 0;
|
||||
@@ -983,7 +982,7 @@ static int umount_by_device(sd_bus *bus, sd_device *dev) {
|
||||
assert(bus);
|
||||
assert(dev);
|
||||
|
||||
if (sd_device_get_property_value(d, "SYSTEMD_MOUNT_WHERE", &v) >= 0)
|
||||
if (sd_device_get_property_value(dev, "SYSTEMD_MOUNT_WHERE", &v) >= 0)
|
||||
ret = stop_mounts(bus, v);
|
||||
|
||||
r = sd_device_get_devname(dev, &v);
|
||||
|
||||
Reference in New Issue
Block a user