mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
Adds check whether PID fp was acquired or not. If not, then init logging
facility, print error and exit.
This commit is contained in:
parent
bf1e9952e1
commit
fbf75dd075
@ -748,10 +748,17 @@ ipmievd_main(struct ipmi_event_intf * eintf, int argc, char ** argv)
|
||||
|
||||
umask(022);
|
||||
fp = ipmi_open_file_write(pidfile);
|
||||
if (fp != NULL) {
|
||||
fprintf(fp, "%d\n", (int)getpid());
|
||||
fclose(fp);
|
||||
if (fp == NULL) {
|
||||
/* Failed to get fp on PID file -> exit. */
|
||||
log_halt();
|
||||
log_init("ipmievd", daemon, verbose);
|
||||
lprintf(LOG_ERR,
|
||||
"Failed to open PID file '%s' for writing. Check file permission.\n",
|
||||
pidfile);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
fprintf(fp, "%d\n", (int)getpid());
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
/* register signal handler for cleanup */
|
||||
|
Loading…
x
Reference in New Issue
Block a user