summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd.c
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2017-11-03 11:53:12 +0530
committerAtin Mukherjee <amukherj@redhat.com>2017-11-06 03:56:48 +0000
commitf461d75b226a5bc6c088280e43a96f9b54f33af5 (patch)
tree9c743476a35a85777f79c183c65363a1d184697b /xlators/mgmt/glusterd/src/glusterd.c
parent0f10b1a5caa78d723b3e8b879d1de162730913ce (diff)
glusterd: Fix few coverity errors
Fixes issues 810, 248, 491, 499, 85, 786, 811, 43, and 44 from the report at [1]. [1]: https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/ BUG: 789278 Change-Id: I27ebae2ffb2256b8eef0757d768cc46e5a942e9f Signed-off-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c
index 96019a91050..85ae51ba9fc 100644
--- a/xlators/mgmt/glusterd/src/glusterd.c
+++ b/xlators/mgmt/glusterd/src/glusterd.c
@@ -1005,7 +1005,7 @@ check_prepare_mountbroker_root (char *mountbroker_root)
sys_close (dfd0);
if (dfd != -1)
sys_close (dfd);
- if (dfd2 != -1)
+ if (dfd2 != -1 && dfd != dfd2)
sys_close (dfd2);
return ret;
@@ -1807,8 +1807,8 @@ init (xlator_t *this)
conf->rpc = rpc;
conf->uds_rpc = uds_rpc;
conf->gfs_mgmt = &gd_brick_prog;
- strncpy (conf->workdir, workdir, PATH_MAX);
- strncpy (conf->rundir, rundir, PATH_MAX);
+ (void) strncpy (conf->workdir, workdir, strlen (workdir) + 1);
+ (void) strncpy (conf->rundir, rundir, strlen (rundir) + 1);
synclock_init (&conf->big_lock, SYNC_LOCK_RECURSIVE);
pthread_mutex_init (&conf->xprt_lock, NULL);