summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorVikas Gorur <vikas@gluster.com>2009-06-08 07:18:18 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-09 09:13:23 -0700
commit358c918c92d70d2eddae54447a7afe9907afbab5 (patch)
tree259fd4c5bc57c1b2561ae44d41d7576251c72a7e /glusterfsd
parent62e3a461d8e1909ab435ddbc4cb0c96bc0339860 (diff)
Print PID after daemonizing glusterfs.
PID used to be printed before glusterfs became a daemon, which is incorrect since becoming a daemon involves forking and thus the PID changes. Fixes bug #8. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 3a0c30f98c7..af931a93938 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1113,7 +1113,7 @@ main (int argc, char *argv[])
argp_help (&argp, stderr, ARGP_HELP_SEE, (char *) argv[0]);
return -1;
}
- _gf_dump_details (argc, argv);
+
if ((graph = _parse_specfp (ctx, specfp)) == NULL) {
/* _parse_specfp() prints necessary error message */
fprintf (stderr, "exiting\n");
@@ -1167,13 +1167,22 @@ main (int argc, char *argv[])
}
/* we are daemon now */
+ _gf_dump_details (argc, argv);
+
/* update pid file, if given */
if (cmd_args->pid_file != NULL) {
fprintf (ctx->pidfp, "%d\n", getpid ());
fflush (ctx->pidfp);
/* we close pid file on exit */
}
- }
+ } else {
+ /*
+ * Need to have this line twice because PID is different
+ * in daemon and non-daemon cases.
+ */
+
+ _gf_dump_details (argc, argv);
+ }
gf_log ("glusterfs", GF_LOG_DEBUG,
"running in pid %d", getpid ());