mirror of
git://sourceware.org/git/lvm2.git
synced 2024-10-28 03:27:58 +03:00
libdaemon-server: Do not create pidfile if NULL.
This commit is contained in:
parent
ff752c60df
commit
329d10268c
@ -466,16 +466,18 @@ void daemon_start(daemon_state s)
|
|||||||
daemon_log_enable(s.log, DAEMON_LOG_OUTLET_SYSLOG, DAEMON_LOG_FATAL, 1);
|
daemon_log_enable(s.log, DAEMON_LOG_OUTLET_SYSLOG, DAEMON_LOG_FATAL, 1);
|
||||||
daemon_log_enable(s.log, DAEMON_LOG_OUTLET_SYSLOG, DAEMON_LOG_ERROR, 1);
|
daemon_log_enable(s.log, DAEMON_LOG_OUTLET_SYSLOG, DAEMON_LOG_ERROR, 1);
|
||||||
|
|
||||||
(void) dm_prepare_selinux_context(s.pidfile, S_IFREG);
|
if (s.pidfile) {
|
||||||
|
(void) dm_prepare_selinux_context(s.pidfile, S_IFREG);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NB. Take care to not keep stale locks around. Best not exit(...)
|
* NB. Take care to not keep stale locks around. Best not exit(...)
|
||||||
* after this point.
|
* after this point.
|
||||||
*/
|
*/
|
||||||
if (dm_create_lockfile(s.pidfile) == 0)
|
if (dm_create_lockfile(s.pidfile) == 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
(void) dm_prepare_selinux_context(NULL, 0);
|
(void) dm_prepare_selinux_context(NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* Set normal exit signals to request shutdown instead of dying. */
|
/* Set normal exit signals to request shutdown instead of dying. */
|
||||||
signal(SIGINT, &_exit_handler);
|
signal(SIGINT, &_exit_handler);
|
||||||
@ -526,7 +528,8 @@ void daemon_start(daemon_state s)
|
|||||||
INFO(&s, "%s shutting down", s.name);
|
INFO(&s, "%s shutting down", s.name);
|
||||||
|
|
||||||
closelog(); /* FIXME */
|
closelog(); /* FIXME */
|
||||||
remove_lockfile(s.pidfile);
|
if (s.pidfile)
|
||||||
|
remove_lockfile(s.pidfile);
|
||||||
if (failed)
|
if (failed)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user