summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.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-snapshot-utils.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-snapshot-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index 1d64e6e980c..13cc1a7785a 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -3218,7 +3218,7 @@ glusterd_copy_file (const char *source, const char *destination)
GF_ASSERT (destination);
/* Here is stat is made to get the file permission of source file*/
- ret = lstat (source, &stbuf);
+ ret = sys_lstat (source, &stbuf);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, errno,
GD_MSG_FILE_OP_FAILED, "%s not found", source);
@@ -3236,7 +3236,7 @@ glusterd_copy_file (const char *source, const char *destination)
goto out;
}
- dest_fd = creat (destination, dest_mode);
+ dest_fd = sys_creat (destination, dest_mode);
if (dest_fd < 0) {
ret = -1;
gf_msg (this->name, GF_LOG_ERROR, 0,
@@ -3246,7 +3246,7 @@ glusterd_copy_file (const char *source, const char *destination)
}
do {
- ret = read (src_fd, buffer, sizeof (buffer));
+ ret = sys_read (src_fd, buffer, sizeof (buffer));
if (ret == -1) {
gf_msg (this->name, GF_LOG_ERROR, errno,
GD_MSG_FILE_OP_FAILED, "Error reading file "
@@ -3257,7 +3257,7 @@ glusterd_copy_file (const char *source, const char *destination)
if (read_len == 0)
break;
- ret = write (dest_fd, buffer, read_len);
+ ret = sys_write (dest_fd, buffer, read_len);
if (ret != read_len) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_FILE_OP_FAILED, "Error writing in "
@@ -3267,10 +3267,10 @@ glusterd_copy_file (const char *source, const char *destination)
} while (ret > 0);
out:
if (src_fd > 0)
- close (src_fd);
+ sys_close (src_fd);
if (dest_fd > 0)
- close (dest_fd);
+ sys_close (dest_fd);
return ret;
}
@@ -3290,14 +3290,14 @@ glusterd_copy_folder (const char *source, const char *destination)
GF_ASSERT (source);
GF_ASSERT (destination);
- dir_ptr = opendir (source);
+ dir_ptr = sys_opendir (source);
if (!dir_ptr) {
gf_msg (this->name, GF_LOG_ERROR, errno,
GD_MSG_DIR_OP_FAILED, "Unable to open %s", source);
goto out;
}
- while ((direntp = readdir (dir_ptr)) != NULL) {
+ while ((direntp = sys_readdir (dir_ptr)) != NULL) {
if (strcmp (direntp->d_name, ".") == 0 ||
strcmp (direntp->d_name, "..") == 0)
continue;
@@ -3321,7 +3321,7 @@ glusterd_copy_folder (const char *source, const char *destination)
}
out:
if (dir_ptr)
- closedir (dir_ptr);
+ sys_closedir (dir_ptr);
return ret;
}
@@ -3463,7 +3463,7 @@ glusterd_copy_quota_files (glusterd_volinfo_t *src_vol,
/* quota.conf is not present if quota is not enabled, Hence ignoring
* the absence of this file
*/
- ret = lstat (src_path, &stbuf);
+ ret = sys_lstat (src_path, &stbuf);
if (ret) {
ret = 0;
gf_msg_debug (this->name, 0, "%s not found", src_path);