summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorNandaja Varma <nvarma@redhat.com>2015-02-05 13:37:37 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-30 00:42:49 -0700
commitb828932c1430bfc62d7c3c83fec8e4a79ca4dbe6 (patch)
treecdb272fc9b37e8642adf1acb0c1fb15e8b0cb480 /xlators
parentf2c1261123798403dd254926db4f2008de4b6d84 (diff)
bd: coverity fixes, removing logically dead code and correcting checks
Coverity CIDs: 1128910 1128911 1128913 1128912 1134020 Change-Id: I2d871723fbfe43f9ff6b3beba7a99b0d81d4aff5 BUG: 789278 Signed-off-by: Nandaja Varma <nvarma@redhat.com> Reviewed-on: http://review.gluster.org/9588 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/storage/bd/src/bd-helper.c5
-rw-r--r--xlators/storage/bd/src/bd.c3
2 files changed, 5 insertions, 3 deletions
diff --git a/xlators/storage/bd/src/bd-helper.c b/xlators/storage/bd/src/bd-helper.c
index 1b1c35bad51..5ca1ef79400 100644
--- a/xlators/storage/bd/src/bd-helper.c
+++ b/xlators/storage/bd/src/bd-helper.c
@@ -272,7 +272,8 @@ __bd_fd_ctx_get (xlator_t *this, fd_t *fd, bd_fd_t **bdfd_p)
out:
GF_FREE (devpath);
if (ret) {
- close (_fd);
+ if (_fd >= 0)
+ close (_fd);
GF_FREE (bdfd);
}
return ret;
@@ -905,7 +906,7 @@ bd_do_ioctl_zerofill (bd_priv_t *priv, bd_attr_t *bdatt, int fd, char *vg,
uuid_utoa_r (bdatt->iatt.ia_gfid, uuid);
sprintf (lvname, "/dev/%s/%s", vg, uuid);
- readlink (lvname, dmname, sizeof (dmname));
+ readlink (lvname, dmname, sizeof (dmname) - 1);
p = strrchr (dmname, '/');
if (p)
diff --git a/xlators/storage/bd/src/bd.c b/xlators/storage/bd/src/bd.c
index 6ea18e7787b..85372f072ed 100644
--- a/xlators/storage/bd/src/bd.c
+++ b/xlators/storage/bd/src/bd.c
@@ -693,7 +693,8 @@ out:
GF_FREE (devpath);
if (ret) {
- close (_fd);
+ if (_fd >= 0)
+ close (_fd);
GF_FREE (bd_fd);
}