summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-09-24 00:29:29 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-24 03:53:45 -0700
commit0209aab58c56e06fd86487be76312d04fd8f5593 (patch)
treeaf8c0776a68c32270e8d1b5955dd3a1f94833442 /glusterfsd
parentad9c5f801ebffb0993d5f764b27e12b01beba2ce (diff)
glusterfsd: handle relative path for '--volfile/-f' option
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index d73be8fdd3e..f1cd0270735 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: