summaryrefslogtreecommitdiffstats
path: root/glusterfsd/src
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-05-31 06:39:41 +0000
committerAnand Avati <avati@gluster.com>2011-05-31 09:10:49 -0700
commit756c7aea3fef2a77b13ed731ab202c5426db3768 (patch)
treefc517552fdeaac3bdf08932c411d20a914ecc71e /glusterfsd/src
parent753f17aca63057e4c4a70c1f3cbf7729f890cb69 (diff)
glusterfsd: prevent giving '-s' option without '--volfile-id' option
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2934 (for glusterfs binary, -s option without --volfile-id will fail without any notice to user) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2934
Diffstat (limited to 'glusterfsd/src')
-rw-r--r--glusterfsd/src/glusterfsd.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 2d2024409ee..2f535e6be2e 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -1047,6 +1047,16 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
process_mode = gf_get_process_mode (argv[0]);
+ /* Make sure after the parsing cli, if '--volfile-server' option is
+ given, then '--volfile-id' is mandatory */
+ if (cmd_args->volfile_server && !cmd_args->volfile_id) {
+ gf_log ("glusterfs", GF_LOG_CRITICAL,
+ "ERROR: '--volfile-id' is mandatory if '-s' OR "
+ "'--volfile-server' option is given");
+ ret = -1;
+ goto out;
+ }
+
if ((cmd_args->volfile_server == NULL)
&& (cmd_args->volfile == NULL)) {
if (process_mode == GF_SERVER_PROCESS)
@@ -1080,15 +1090,18 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
cmd_args->log_file);
if (ret == -1) {
fprintf (stderr, "ERROR: symlink of logfile failed\n");
- } else {
- GF_FREE (cmd_args->log_file);
- cmd_args->log_file = gf_strdup (tmp_logfile);
+ goto out;
}
+ GF_FREE (cmd_args->log_file);
+ cmd_args->log_file = gf_strdup (tmp_logfile);
+
GF_FREE (tmp_logfile_dyn);
}
}
+ ret = 0;
+out:
return ret;
}