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
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.
* the parent can be signaled...
*/
sleep(1);
+ } else if (errno == ESRCH) {
+ log_info("Removed stale PID file");
+ (void) unlink(path_dhclient_pid);
}
}
fclose(pidfd);
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);
}
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);
}
free_everything ();
omapi_print_dmalloc_usage_by_caller ();
#endif
+ if (no_pid_file == ISC_FALSE)
+ (void) unlink(path_dhcpd_pid);
exit (0);
}
#else
free_everything ();
omapi_print_dmalloc_usage_by_caller ();
#endif
+ if (no_pid_file == ISC_FALSE)
+ (void) unlink(path_dhcpd_pid);
exit (0);
}
#endif