summaryrefslogtreecommitdiffstats
path: root/glusterfsd/src
diff options
context:
space:
mode:
Diffstat (limited to 'glusterfsd/src')
-rw-r--r--glusterfsd/src/glusterfsd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 4977e2b72..87d16c7dc 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -469,7 +469,13 @@ parse_opts (int key, char *arg, struct argp_state *state)
GF_FREE (cmd_args->volfile);
if (arg[0] != '/') {
- pwd = getcwd (NULL, 0);
+ pwd = getcwd (NULL, PATH_MAX);
+ if (!pwd) {
+ argp_failure (state, -1, errno,
+ "getcwd failed with error no %d",
+ errno);
+ break;
+ }
snprintf (tmp_buf, 1024, "%s/%s", pwd, arg);
cmd_args->volfile = gf_strdup (tmp_buf);
free (pwd);