summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorSunny Kumar <sunkumar@redhat.com>2018-08-29 01:39:28 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-08-30 12:15:52 +0000
commita38f9cb7a6c9a25ceef9a0638add39dfd2b0c0d9 (patch)
tree2afc34ddb8ae5f02a07ee53ca6713c28c883441e /xlators/mgmt
parent44e40404ed1223ba9ccb879373da38efd5ba403c (diff)
glusterd : fix some coverity issues in glusterd-syncop.c
This patch fixes CID 1382344, 1124655 and 1325537. Change-Id: I2412d6b88483e32a5de1baebb3823a985b2dcfb0 updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 01a88f8e145..4c608ddca70 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -96,7 +96,9 @@ gd_collate_errors (struct syncargs *args, int op_ret, int op_errno,
break;
}
}
- op_err[len] = '\0';
+
+ if (len > 0)
+ op_err[len] = '\0';
if (args->errstr) {
len = snprintf (err_str, sizeof(err_str) - 1,
@@ -1022,7 +1024,7 @@ out:
errno = args.op_errno;
if (args.dict)
dict_unref (args.dict);
- if (args.op_ret && (*errstr == NULL)) {
+ if (args.op_ret && errstr && (*errstr == NULL)) {
if (op == GD_OP_HEAL_VOLUME) {
gf_asprintf (errstr,
"Glusterd Syncop Mgmt brick op '%s' failed."
@@ -1576,7 +1578,7 @@ gd_unlock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, int *op_ret,
} else {
ret = dict_get_int32 (op_ctx, "hold_global_locks", &global);
- if (global)
+ if (!ret && global)
type = "global";
else
type = "vol";