mirror of
https://github.com/ipmitool/ipmitool.git
synced 2026-06-24 06:11:36 +00:00
Fixes ignorance of existing PID file which results in PID being overwritten.
Start of the daemon has shifted couple lines bellow, because it doesn't make sense to start daemon first and check existence of PID file later.
This commit is contained in:
@@ -737,15 +737,15 @@ ipmievd_main(struct ipmi_event_intf * eintf, int argc, char ** argv)
|
||||
FILE *fp;
|
||||
struct stat st1;
|
||||
|
||||
ipmi_start_daemon(eintf->intf);
|
||||
|
||||
if (lstat(pidfile, &st1) == 0) {
|
||||
/* already exists, erase first */
|
||||
if (unlink(pidfile) != 0) {
|
||||
lprintf(LOG_WARN, "Unable to erase pidfile");
|
||||
}
|
||||
/* PID file already exists -> exit. */
|
||||
lprintf(LOG_ERR, "PID file '%s' already exists.\n", pidfile);
|
||||
lprintf(LOG_ERR, "Perhaps another instance is already running.\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
ipmi_start_daemon(eintf->intf);
|
||||
|
||||
umask(022);
|
||||
fp = ipmi_open_file_write(pidfile);
|
||||
if (fp != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user