From 0209aab58c56e06fd86487be76312d04fd8f5593 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 24 Sep 2010 00:29:29 +0000 Subject: glusterfsd: handle relative path for '--volfile/-f' option Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971 --- glusterfsd/src/glusterfsd.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index d73be8fdd..f1cd02707 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -410,10 +410,12 @@ out: static error_t parse_opts (int key, char *arg, struct argp_state *state) { - cmd_args_t *cmd_args = NULL; - uint32_t n = 0; - double d = 0.0; - gf_boolean_t b = _gf_false; + cmd_args_t *cmd_args = NULL; + uint32_t n = 0; + double d = 0.0; + gf_boolean_t b = _gf_false; + char *pwd = NULL; + char tmp_buf[2048] = {0,}; cmd_args = state->input; @@ -456,7 +458,15 @@ parse_opts (int key, char *arg, struct argp_state *state) if (cmd_args->volfile) GF_FREE (cmd_args->volfile); - cmd_args->volfile = gf_strdup (arg); + if (arg[0] != '/') { + pwd = get_current_dir_name (); + snprintf (tmp_buf, 1024, "%s/%s", pwd, arg); + cmd_args->volfile = gf_strdup (tmp_buf); + free (pwd); + } else { + cmd_args->volfile = gf_strdup (arg); + } + break; case ARGP_LOG_SERVER_KEY: -- cgit