mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-22 09:57:20 +00:00
[master] Add code to remove pid files and to log killing of clients
This commit is contained in:
parent
b6ab3f6c2a
commit
f950de775f
5
RELNOTES
5
RELNOTES
@ -103,6 +103,11 @@ by Eric Young (eay@cryptsoft.com).
|
||||
Thanks to Jiri Popelka at Red Hat for the bug and fix.
|
||||
[ISC-Bugs #21238
|
||||
|
||||
- Add a log entry when killing a client and remove the PID files
|
||||
when a server, relay or client are killed.
|
||||
[ISC-Bugs #16970]
|
||||
[ISC-Bugs #17258]
|
||||
|
||||
Changes since 4.3.0rc1
|
||||
|
||||
- None
|
||||
|
@ -408,8 +408,10 @@ main(int argc, char **argv) {
|
||||
e = fscanf(pidfd, "%ld\n", &temp);
|
||||
oldpid = (pid_t)temp;
|
||||
|
||||
if (e != 0 && e != EOF) {
|
||||
if (oldpid && (kill(oldpid, SIGTERM) == 0)) {
|
||||
if (e != 0 && e != EOF && oldpid) {
|
||||
if (kill(oldpid, SIGTERM) == 0) {
|
||||
log_info("Killed old client process");
|
||||
(void) unlink(path_dhclient_pid);
|
||||
/*
|
||||
* wait for the old process to
|
||||
* cleanly terminate.
|
||||
@ -418,6 +420,9 @@ main(int argc, char **argv) {
|
||||
* the parent can be signaled...
|
||||
*/
|
||||
sleep(1);
|
||||
} else if (errno == ESRCH) {
|
||||
log_info("Removed stale PID file");
|
||||
(void) unlink(path_dhclient_pid);
|
||||
}
|
||||
}
|
||||
fclose(pidfd);
|
||||
@ -3867,6 +3872,9 @@ unsigned cons_agent_information_options (cfg_options, outpacket,
|
||||
|
||||
static void shutdown_exit (void *foo)
|
||||
{
|
||||
/* get rid of the pid if we can */
|
||||
if (no_pid_file == ISC_FALSE)
|
||||
(void) unlink(path_dhclient_pid);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
@ -1717,5 +1717,9 @@ dhcp_set_control_state(control_object_state_t oldstate,
|
||||
control_object_state_t newstate) {
|
||||
if (newstate != server_shutdown)
|
||||
return ISC_R_SUCCESS;
|
||||
|
||||
if (no_pid_file == ISC_FALSE)
|
||||
(void) unlink(path_dhcrelay_pid);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -1354,6 +1354,8 @@ static isc_result_t dhcp_io_shutdown_countdown (void *vlp)
|
||||
free_everything ();
|
||||
omapi_print_dmalloc_usage_by_caller ();
|
||||
#endif
|
||||
if (no_pid_file == ISC_FALSE)
|
||||
(void) unlink(path_dhcpd_pid);
|
||||
exit (0);
|
||||
}
|
||||
#else
|
||||
@ -1363,6 +1365,8 @@ static isc_result_t dhcp_io_shutdown_countdown (void *vlp)
|
||||
free_everything ();
|
||||
omapi_print_dmalloc_usage_by_caller ();
|
||||
#endif
|
||||
if (no_pid_file == ISC_FALSE)
|
||||
(void) unlink(path_dhcpd_pid);
|
||||
exit (0);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user