diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-02-22 08:30:47 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-02-22 23:12:46 -0800 |
commit | 72187f8e02e7d3aa17636ade033482e4de41657a (patch) | |
tree | f88b7c8b5f649b2b24f2cbe89b9e190c67d93349 /glusterfsd/src | |
parent | 683ce1bca3b6c541e565eec014fa7cc3308957d8 (diff) |
glusterfsd: give out the error on screen when cmd is given without options
'glusterfs' cmd would take default options when no option is given,
but sometimes default option may not work, in that case, we need
to provide usage output
Change-Id: I2ebd342890da11d2afaa0a23ee3a01d87694ff28
BUG: 791198
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: http://review.gluster.com/2790
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'glusterfsd/src')
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 573aca561..ca6b9b381 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -1136,6 +1136,19 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx) cmd_args->volfile = gf_strdup (DEFAULT_GLUSTERD_VOLFILE); else cmd_args->volfile = gf_strdup (DEFAULT_CLIENT_VOLFILE); + + /* Check if the volfile exists, if not give usage output + and exit */ + ret = stat (cmd_args->volfile, &stbuf); + if (ret) { + gf_log ("glusterfs", GF_LOG_CRITICAL, + "ERROR: parsing the volfile failed (%s)\n", + strerror (errno)); + /* argp_usage (argp.) */ + fprintf (stderr, "USAGE: %s [options] [mountpoint]\n", + argv[0]); + goto out; + } } if (cmd_args->run_id) { |