summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2012-09-08 12:12:48 +0530
committerAnand Avati <avati@redhat.com>2012-09-08 11:28:58 -0700
commit5499205a08c0b69156628684b5dc235f1355b026 (patch)
treec4d2a9a61742c4f57cd037a3fac898d753ad8209
parent7a2362d818baf7cae0ae54ffede436821491c876 (diff)
glusterd: Expect setmntent(3) to return NULL
- Closed the mtab FILE * using endmntent(3) Change-Id: I5e1ebb7f092abda638cfbb5524da693dcac6c872 BUG: 851109 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/3920 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 3a48a41d7..b5596b925 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -3814,6 +3814,11 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo,
goto out;
mtab = setmntent (_PATH_MOUNTED, "r");
+ if (!mtab) {
+ ret = -1;
+ goto out;
+ }
+
entry = getmntent (mtab);
while (1) {
@@ -3854,6 +3859,9 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo,
out:
GF_FREE (mnt_pt);
+ if (mtab)
+ endmntent (mtab);
+
return ret;
}
#endif