diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2012-11-16 13:48:58 -0500 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-11-23 02:40:02 -0800 |
commit | 6dee0e3d99dd3423edc6ad2981733fac3ef8c67d (patch) | |
tree | 533dfbbb6508264bcadf5dac0dfd5769df997130 | |
parent | 2fad4eb4efb13d5bf79b4425afa9ce3f87c13e85 (diff) |
glusterd: fix use of undefined realpath(3) result
Change-Id: Ic50ae192c99cece25cd63f2277fb440fca5f0b04
BUG: 877522
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-on: http://review.gluster.org/4201
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 28b9cdc78fc..726aa3a1bb3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -824,8 +824,13 @@ glusterd_is_brickpath_available (uuid_t uuid, char *path) strncpy (tmp_path, path, PATH_MAX); /* path may not yet exist */ - if (!realpath (path, tmp_path) && (errno != ENOENT)) - goto out; + if (!realpath (path, tmp_path)) { + if (errno != ENOENT) { + goto out; + } + /* When realpath(3) fails, tmp_path is undefined. */ + strncpy(tmp_path,path,PATH_MAX); + } list_for_each_entry (volinfo, &priv->volumes, vol_list) { list_for_each_entry (brickinfo, &volinfo->bricks, brick_list) { |