diff options
author | shishir gowda <shishirng@gluster.com> | 2011-02-18 00:06:26 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2011-02-22 02:11:30 -0800 |
commit | ccee8039720f8253d460384aa6659edd8e75f3db (patch) | |
tree | 0ba564335a9ab07d3c394dbe79f46690dd2646c3 /glusterfsd/src | |
parent | 65e5cc0f394e1d2faaab3dc5d097a3f01b03dd41 (diff) |
Fix getcwd size arg to make it work in solaris.
glusterfs/d -f path failed if the path was not absolute.
If the BUF argument is NULL, then on solaris the size argument has to be passed.
On linux, if the size argument passed is 0, then it dynmically allocates a buffer
of the required size. The fix is to pass PATH_MAX as the size for consistency.
Signed-off-by: Shishir Gowda <shishirng@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 2443 (starting glusterfs/d -f with relative path crashes)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2443
Diffstat (limited to 'glusterfsd/src')
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 4977e2b727c..87d16c7dcf9 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); |