From 063d4ead61ee47433793de81a1c77e0ba69e6e07 Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Fri, 16 Oct 2015 13:52:28 -0400 Subject: 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 Reviewed-on: http://review.gluster.org/12379 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/mgmt/glusterd/src/glusterd-mountbroker.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-mountbroker.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c index 4ed2fb7035..3125612d2c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c +++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c @@ -17,6 +17,7 @@ #include "dict.h" #include "list.h" #include "logging.h" +#include "syscall.h" #include "defaults.h" #include "compat.h" #include "compat-errno.h" @@ -587,16 +588,16 @@ glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno) sla = strrchr (mtptemp, '/'); *sla = '\0'; - ret = mkdir (mtptemp, 0700); + ret = sys_mkdir (mtptemp, 0700); if (ret == 0) - ret = chown (mtptemp, uid, 0); + ret = sys_chown (mtptemp, uid, 0); else if (errno == EEXIST) ret = 0; if (ret == -1) { *op_errno = errno; goto out; } - ret = lstat (mtptemp, &st); + ret = sys_lstat (mtptemp, &st); if (ret == -1) { *op_errno = errno; goto out; @@ -628,7 +629,7 @@ glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno) *op_errno = errno; goto out; } - close (ret); + sys_close (ret); /*** assembly the path from cookie to mountpoint */ sla = strchr (sla - 1, '/'); @@ -642,9 +643,9 @@ glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno) /*** create cookie link in (to-be) mountpoint, move it over to the final place */ *cookieswitch = '/'; - ret = symlink (mntlink, mtptemp); + ret = sys_symlink (mntlink, mtptemp); if (ret != -1) - ret = rename (mtptemp, cookie); + ret = sys_rename (mtptemp, cookie); *cookieswitch = '\0'; if (ret == -1) { *op_errno = errno; @@ -674,12 +675,12 @@ glusterd_do_mount (char *label, dict_t *argdict, char **path, int *op_errno) strerror (*op_errno)); if (mtptemp) { *cookieswitch = '/'; - unlink (mtptemp); + sys_unlink (mtptemp); *cookieswitch = '\0'; - rmdir (mtptemp); + sys_rmdir (mtptemp); } if (cookie) { - unlink (cookie); + sys_unlink (cookie); GF_FREE (cookie); } -- cgit