summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-replace-brick.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
index 5a98d497137..11e15c55f46 100644
--- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c
@@ -896,7 +896,7 @@ rb_generate_client_volfile (glusterd_volinfo_t *volinfo,
"%s", strerror (errno));
goto out;
}
- close (fd);
+ sys_close (fd);
file = fopen (filename, "w+");
if (!file) {
@@ -920,12 +920,14 @@ rb_generate_client_volfile (glusterd_volinfo_t *volinfo,
glusterd_auth_get_username (volinfo),
glusterd_auth_get_password (volinfo));
- fclose (file);
GF_FREE (ttype);
ret = 0;
out:
+ if (file)
+ fclose (file);
+
return ret;
}
@@ -969,13 +971,13 @@ rb_generate_dst_brick_volfile (glusterd_volinfo_t *volinfo,
priv->workdir, volinfo->volname,
RB_DSTBRICKVOL_FILENAME);
- fd = creat (filename, S_IRUSR | S_IWUSR);
+ fd = sys_creat (filename, S_IRUSR | S_IWUSR);
if (fd < 0) {
gf_log (this->name, GF_LOG_ERROR,
"%s", strerror (errno));
goto out;
}
- close (fd);
+ sys_close (fd);
file = fopen (filename, "w+");
if (!file) {
@@ -1005,11 +1007,12 @@ rb_generate_dst_brick_volfile (glusterd_volinfo_t *volinfo,
GF_FREE (trans_type);
- fclose (file);
-
ret = 0;
out:
+ if (file)
+ fclose (file);
+
return ret;
}