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-09 10:41:20 -0700
commit0b60e7252650355f412974bfc840bc2fc81b4157 (patch)
treecd8f9c04f8c04dad824b35fee16015e8307e9ff4
parentace4cae71c19004c51fe5116c67492acaf2afc73 (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/3922 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 3593683..7752d35 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -3779,6 +3779,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) {
@@ -3818,8 +3823,10 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo,
ret = dict_set_dynstr (dict, key, mnt_options);
out:
- if (mnt_pt)
- GF_FREE (mnt_pt);
+ GF_FREE (mnt_pt);
+ if (mtab)
+ endmntent (mtab);
+
return ret;
}
#endif