summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 1b1c35b..5ca1ef7 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 6ea18e7..85372f0 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);
}