summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorVarsha Rao <varao@redhat.com>2018-04-13 16:16:43 +0530
committerAravinda VK <avishwan@redhat.com>2018-05-03 05:03:26 +0000
commit11b747bcec316aad77c68451346e092f33b2f218 (patch)
tree9d49231b7777862a47e9b9ac33325ce286be608d /xlators/mgmt
parent4e7b423d3c3137c3f83b71b36279e1a544154833 (diff)
downloadglusterfs-11b747bcec316aad77c68451346e092f33b2f218.tar.gz
glusterfs-11b747bcec316aad77c68451346e092f33b2f218.tar.xz
glusterfs-11b747bcec316aad77c68451346e092f33b2f218.zip
glusterd/geo-rep: Fix UNUSED_VALUE coverity issue
The return value of glusterd_get_local_brickpaths is unused so add goto statement. As it is reinitialized outside the if block. Also change the if condition to check the failure case, when return value is -1 and path_list is NULL. Change-Id: I6b47d7751263f704bd69a6452a7e71bfcf226d49 updates: bz#789278 Signed-off-by: Varsha Rao <varao@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c14
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c10
2 files changed, 12 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
index a7b56617df..25193e2a51 100644
--- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
+++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c
@@ -3648,8 +3648,8 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr)
if (ret) {
ret = glusterd_get_local_brickpaths (volinfo,
&path_list);
- if (path_list)
- ret = -1;
+ if (!path_list && ret == -1)
+ goto out;
}
/* Check for geo-rep session is active or not for
@@ -3681,10 +3681,8 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr)
if (ret) {
ret = glusterd_get_local_brickpaths (volinfo,
&path_list);
- if (path_list) {
- ret = -1;
+ if (!path_list && ret == -1)
goto out;
- }
}
/* Check for geo-rep session is active or not
@@ -3704,10 +3702,8 @@ glusterd_op_stage_gsync_set (dict_t *dict, char **op_errstr)
if (ret) {
ret = glusterd_get_local_brickpaths (volinfo,
&path_list);
- if (path_list) {
- ret = -1;
+ if (!path_list && ret == -1)
goto out;
- }
}
}
break;
@@ -5570,6 +5566,8 @@ glusterd_op_gsync_set (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
}
ret = glusterd_get_local_brickpaths (volinfo, &path_list);
+ if (!path_list && ret == -1)
+ goto out;
}
if (type == GF_GSYNC_OPTION_TYPE_CONFIG) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 6437d038cd..f7b6ffc21a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -7835,7 +7835,8 @@ glusterd_get_local_brickpaths (glusterd_volinfo_t *volinfo, char **pathlist)
path_tokens = GF_CALLOC (sizeof(char*), volinfo->brick_count,
gf_gld_mt_charptr);
if (!path_tokens) {
- gf_msg_debug ("glusterd", 0, "Could not allocate memory.");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY,
+ "Could not allocate memory.");
ret = -1;
goto out;
}
@@ -7852,8 +7853,8 @@ glusterd_get_local_brickpaths (glusterd_volinfo_t *volinfo, char **pathlist)
path[sizeof(path)-1] = '\0';
path_tokens[count] = gf_strdup (path);
if (!path_tokens[count]) {
- gf_msg_debug ("glusterd", 0,
- "Could not allocate memory.");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM,
+ GD_MSG_NO_MEMORY, "Could not allocate memory.");
ret = -1;
goto out;
}
@@ -7864,7 +7865,8 @@ glusterd_get_local_brickpaths (glusterd_volinfo_t *volinfo, char **pathlist)
tmp_path_list = GF_CALLOC (sizeof(char), total_len + 1,
gf_gld_mt_char);
if (!tmp_path_list) {
- gf_msg_debug ("glusterd", 0, "Could not allocate memory.");
+ gf_msg ("glusterd", GF_LOG_ERROR, ENOMEM, GD_MSG_NO_MEMORY,
+ "Could not allocate memory.");
ret = -1;
goto out;
}