public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] blkmapd: unlink pid file when error out
@ 2016-07-14  2:51 Kinglong Mee
  2016-07-20 15:14 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Kinglong Mee @ 2016-07-14  2:51 UTC (permalink / raw)
  To: Steve Dickson; +Cc: linux-nfs, Kinglong Mee

Fix some error out without unlink pid file.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 utils/blkmapd/device-discovery.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index 50e2746..8eb3fd0 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -486,13 +486,13 @@ int main(int argc, char **argv)
 	signal(SIGHUP, SIG_IGN);
 
 	if (dflag) {
-		bl_discover_devices();
-		exit(0);
+		ret = bl_discover_devices();
+		goto out;
 	}
 
 	if ((bl_watch_fd = inotify_init()) < 0) {
 		BL_LOG_ERR("init inotify failed %s\n", strerror(errno));
-		exit(1);
+		goto out;
 	}
 
 	/* open pipe file */
@@ -513,7 +513,7 @@ int main(int argc, char **argv)
 			BL_LOG_ERR("inquiry process return %d\n", ret);
 		}
 	}
-
+out:
 	if (pidfd >= 0) {
 		close(pidfd);
 		unlink(PID_FILE);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-20 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-14  2:51 [PATCH 2/2] blkmapd: unlink pid file when error out Kinglong Mee
2016-07-20 15:14 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox