mirror of
https://github.com/systemd/systemd
synced 2024-07-22 10:44:58 +00:00
libsystemd-network: do not trigger assertion by sd_*_is_running() with NULL
If systemd is built with developer mode, previously they trigger hard assertions. Even built with release mode, we should not log about that. Let's silently accept NULL and return false. Prompted by https://github.com/systemd/systemd/pull/32166#issuecomment-2044710151.
This commit is contained in:
parent
6dfaa0edaf
commit
8e91738fe9
|
@ -1417,7 +1417,8 @@ int sd_dhcp6_client_stop(sd_dhcp6_client *client) {
|
|||
}
|
||||
|
||||
int sd_dhcp6_client_is_running(sd_dhcp6_client *client) {
|
||||
assert_return(client, -EINVAL);
|
||||
if (!client)
|
||||
return false;
|
||||
|
||||
return client->state != DHCP6_STATE_STOPPED;
|
||||
}
|
||||
|
|
|
@ -564,7 +564,8 @@ int sd_ipv4acd_get_address(sd_ipv4acd *acd, struct in_addr *address) {
|
|||
}
|
||||
|
||||
int sd_ipv4acd_is_running(sd_ipv4acd *acd) {
|
||||
assert_return(acd, false);
|
||||
if (!acd)
|
||||
return false;
|
||||
|
||||
return acd->state != IPV4ACD_STATE_INIT;
|
||||
}
|
||||
|
|
|
@ -206,7 +206,8 @@ int sd_ipv4ll_set_address_seed(sd_ipv4ll *ll, uint64_t seed) {
|
|||
}
|
||||
|
||||
int sd_ipv4ll_is_running(sd_ipv4ll *ll) {
|
||||
assert_return(ll, false);
|
||||
if (!ll)
|
||||
return false;
|
||||
|
||||
return sd_ipv4acd_is_running(ll->acd);
|
||||
}
|
||||
|
|
|
@ -81,7 +81,8 @@ sd_event *sd_radv_get_event(sd_radv *ra) {
|
|||
}
|
||||
|
||||
int sd_radv_is_running(sd_radv *ra) {
|
||||
assert_return(ra, false);
|
||||
if (!ra)
|
||||
return false;
|
||||
|
||||
return ra->state != RADV_STATE_IDLE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue