From 8ce08eb78165c9107925f23ac3057ee2cc01ff2f Mon Sep 17 00:00:00 2001 From: Mohammed Junaid Ahmed Date: Tue, 15 Feb 2011 11:34:51 +0000 Subject: syncdaemon: Checking for the existence of gsyncd by trying to aquire a lock on the pidfile. If the locking succeeds then gsyncd is not running and if it fails then it means that gsyncd is running. Signed-off-by: Junaid Signed-off-by: Anand V. Avati BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570 --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 65203328..89e6f47c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -1952,13 +1952,14 @@ gsync_status (char *master, char *slave, int *status) file = fopen (pidfile, "r+"); if (file) { - // ret = lockf (fileno (file), F_TEST, 0); - //if (ret == 0) - //*status = -1; - //else - *status = 0; + ret = lockf (fileno (file), F_TEST, 0); + if (ret == 0) + *status = -1; + else + *status = 0; } else *status = -1; + ret = 0; out: return ret; } -- cgit