diff options
Diffstat (limited to 'libglusterfs/src/common-utils.c')
| -rw-r--r-- | libglusterfs/src/common-utils.c | 15 | 
1 files changed, 13 insertions, 2 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 0486409a849..e180dd3eec0 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -3646,15 +3646,17 @@ gf_is_service_running (char *pidfile, int *pid)          int             fno = 0;          file = fopen (pidfile, "r+"); -        if (!file) +        if (!file) {                  goto out; +        }          fno = fileno (file);          ret = lockf (fno, F_TEST, 0);          if (ret == -1)                  running = _gf_true; -        if (!pid) +        if (!pid) {                  goto out; +        }          ret = fscanf (file, "%d", pid);          if (ret <= 0) { @@ -3663,6 +3665,15 @@ gf_is_service_running (char *pidfile, int *pid)                  *pid = -1;          } +        if (!*pid) { +                /* +                 * PID 0 means we've started the process, but it hasn't gotten +                 * far enough to put in a real PID yet.  More details are in +                 * glusterd_brick_start. +                 */ +                running = _gf_true; +        } +  out:          if (file)                  fclose (file);  | 
