@@ -1560,7 +1560,7 @@ child (void * param)
struct vectors * vecs;
struct multipath * mpp;
int i;
- int rc;
+ int rc, pid_rc;
mlockall(MCL_CURRENT | MCL_FUTURE);
@@ -1667,9 +1667,8 @@ child (void * param)
pthread_mutex_lock(&exit_mutex);
/* Startup complete, create logfile */
- if (pidfile_create(DEFAULT_PIDFILE, daemon_pid))
- /* Ignore errors, we can live without */
- condlog(1, "failed to create pidfile");
+ pid_rc = pidfile_create(DEFAULT_PIDFILE, daemon_pid);
+ /* Ignore errors, we can live without */
running_state = DAEMON_RUNNING;
pthread_cond_wait(&exit_cond, &exit_mutex);
@@ -1715,8 +1714,10 @@ child (void * param)
dm_lib_exit();
/* We're done here */
- condlog(3, "unlink pidfile");
- unlink(DEFAULT_PIDFILE);
+ if (!pid_rc) {
+ condlog(3, "unlink pidfile");
+ unlink(DEFAULT_PIDFILE);
+ }
condlog(2, "--------shut down-------");
We can use CLI commands to communicate with the daemon, so we don't need the pidfile for correct operation. Hence any errors from creating the pidfile can be safely ignored. Signed-off-by: Hannes Reinecke <hare@suse.de> --- multipathd/main.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)