From 72187f8e02e7d3aa17636ade033482e4de41657a Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 22 Feb 2012 08:30:47 +0530 Subject: 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 Reviewed-on: http://review.gluster.com/2790 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- glusterfsd/src/glusterfsd.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 573aca5611e..ca6b9b3810d 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) { -- cgit