[PATCH 38/42] multipathd: Ignore errors when creating pidfile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 multipathd/main.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index 7fe9c5b..6c5e243 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -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-------");
 
-- 
1.7.4.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel


[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux