mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-31 17:17:43 +03:00
sd-dhcp-server: make sd_dhcp_server_start() no-op if it is already running
This commit is contained in:
parent
1d28a3cf6c
commit
b27e5d53f3
@ -1202,6 +1202,10 @@ int sd_dhcp_server_start(sd_dhcp_server *server) {
|
||||
|
||||
assert_return(server, -EINVAL);
|
||||
assert_return(server->event, -EINVAL);
|
||||
|
||||
if (sd_dhcp_server_is_running(server))
|
||||
return 0;
|
||||
|
||||
assert_return(!server->receive_message, -EBUSY);
|
||||
assert_return(server->fd_raw < 0, -EBUSY);
|
||||
assert_return(server->fd < 0, -EBUSY);
|
||||
|
@ -61,7 +61,7 @@ static int test_basic(sd_event *event, bool bind_to_interface) {
|
||||
return log_info_errno(r, "sd_dhcp_server_start failed: %m");
|
||||
assert_se(r >= 0);
|
||||
|
||||
assert_se(sd_dhcp_server_start(server) == -EBUSY);
|
||||
assert_se(sd_dhcp_server_start(server) >= 0);
|
||||
assert_se(sd_dhcp_server_stop(server) >= 0);
|
||||
assert_se(sd_dhcp_server_stop(server) >= 0);
|
||||
assert_se(sd_dhcp_server_start(server) >= 0);
|
||||
|
Loading…
Reference in New Issue
Block a user