summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-volgen.c
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2015-10-16 13:52:28 -0400
committerJeff Darcy <jdarcy@redhat.com>2015-10-28 06:55:04 -0700
commit063d4ead61ee47433793de81a1c77e0ba69e6e07 (patch)
tree484f5fe3093d7eec12a282f77e2df496afff6ee2 /xlators/mgmt/glusterd/src/glusterd-volgen.c
parent641b3a9164227db52df1aab05795c90d06b315f2 (diff)
core: use syscall wrappers instead of direct syscalls -- glusterd
various xlators and other components are invoking system calls directly instead of using the libglusterfs/syscall.[ch] wrappers. If not using the system call wrappers there should be a comment in the source explaining why the wrapper isn't used. Change-Id: I28bf2a5f7730b35914e7ab57fed91e1966b30073 BUG: 1267967 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/12379 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index aa6aa169ed2..e837b2fc83a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -16,6 +16,7 @@
#include "xlator.h"
#include "glusterd.h"
#include "defaults.h"
+#include "syscall.h"
#include "logging.h"
#include "dict.h"
#include "graph-utils.h"
@@ -915,7 +916,7 @@ volgen_apply_filters (char *orig_volfile)
char *filterpath = NULL;
struct stat statbuf = {0,};
- filterdir = opendir(FILTERDIR);
+ filterdir = sys_opendir (FILTERDIR);
if (!filterdir) {
return;
}
@@ -936,7 +937,7 @@ volgen_apply_filters (char *orig_volfile)
continue;
}
/* Deliberately use stat instead of lstat to allow symlinks. */
- if (stat(filterpath,&statbuf) == (-1)) {
+ if (sys_stat(filterpath, &statbuf) == (-1)) {
goto free_fp;
}
if (!S_ISREG(statbuf.st_mode)) {
@@ -947,7 +948,7 @@ volgen_apply_filters (char *orig_volfile)
* this entirely and check for EPERM after exec fails, but this
* is cleaner.
*/
- if (access(filterpath,X_OK) != 0) {
+ if (sys_access(filterpath, X_OK) != 0) {
goto free_fp;
}
if (runcmd(filterpath,orig_volfile,NULL)) {
@@ -960,7 +961,7 @@ free_fp:
GF_FREE(filterpath);
}
- closedir (filterdir);
+ sys_closedir (filterdir);
}
static int
@@ -979,14 +980,14 @@ volgen_write_volfile (volgen_graph_t *graph, char *filename)
goto error;
}
- fd = creat (ftmp, S_IRUSR | S_IWUSR);
+ fd = sys_creat (ftmp, S_IRUSR | S_IWUSR);
if (fd < 0) {
gf_msg (this->name, GF_LOG_ERROR, errno,
GD_MSG_FILE_OP_FAILED, "file creation failed");
goto error;
}
- close (fd);
+ sys_close (fd);
f = fopen (ftmp, "w");
if (!f)
@@ -1011,7 +1012,7 @@ volgen_write_volfile (volgen_graph_t *graph, char *filename)
f = NULL;
- if (rename (ftmp, filename) == -1)
+ if (sys_rename (ftmp, filename) == -1)
goto error;
GF_FREE (ftmp);
@@ -5058,7 +5059,7 @@ generate_brick_volfiles (glusterd_volinfo_t *volinfo)
return -1;
}
if (ret >= 0) {
- close (ret);
+ sys_close (ret);
/* If snap_volume, retain timestamp for marker.tstamp
* from parent. Geo-replication depends on mtime of
* 'marker.tstamp' to decide the volume-mark, i.e.,
@@ -5080,7 +5081,7 @@ generate_brick_volfiles (glusterd_volinfo_t *volinfo)
}
}
} else {
- ret = unlink (tstamp_file);
+ ret = sys_unlink (tstamp_file);
if (ret == -1 && errno == ENOENT)
ret = 0;
if (ret == -1) {
@@ -5747,7 +5748,7 @@ glusterd_delete_volfile (glusterd_volinfo_t *volinfo,
GF_ASSERT (brickinfo);
get_brick_filepath (filename, volinfo, brickinfo);
- ret = unlink (filename);
+ ret = sys_unlink (filename);
if (ret)
gf_msg ("glusterd", GF_LOG_ERROR, errno,
GD_MSG_FILE_OP_FAILED,