From 3066a21caafab6305527991de11c8eb43ec0044c Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Thu, 1 Oct 2015 16:31:19 -0400 Subject: core: use syscall wrappers instead of direct syscalls - miscellaneous 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: I1f47820534c890a00b452fa61f7438eb2b3f667c BUG: 1267967 Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: http://review.gluster.org/12276 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy --- xlators/cluster/dht/src/dht-rebalance.c | 3 ++- xlators/cluster/dht/src/tier.c | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/dht/src') diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index fab4e2f0ece..c0e10f2dbc6 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -11,6 +11,7 @@ #include "dht-common.h" #include "xlator.h" +#include "syscall.h" #include #include #include @@ -1718,7 +1719,7 @@ gf_listener_stop (xlator_t *this) GF_ASSERT (ctx); cmd_args = &ctx->cmd_args; if (cmd_args->sock_file) { - ret = unlink (cmd_args->sock_file); + ret = sys_unlink (cmd_args->sock_file); if (ret && (ENOENT == errno)) { ret = 0; } diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index bd78e7849d0..9930fe063e1 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -12,6 +12,7 @@ #include "dht-common.h" #include "tier.h" +#include "syscall.h" /*Hard coded DB info*/ static gfdb_db_type_t dht_tier_db_type = GFDB_SQLITE3; @@ -1088,8 +1089,8 @@ tier_migrate_files_using_qfile (demotion_args_t *comp, fclose (query_cbk_args->queryFILE); query_cbk_args->queryFILE = NULL; if (ret) { - sprintf (renamed_file, "%s.err", qfile); - rename (qfile, renamed_file); + snprintf (renamed_file, sizeof renamed_file, "%s.err", qfile); + sys_rename (qfile, renamed_file); } out: return ret; @@ -1224,7 +1225,7 @@ tier_get_bricklist (xlator_t *xl, struct list_head *local_bricklist_head) goto out; } - sprintf(local_brick->brick_db_path, "%s/%s/%s", rv, + snprintf(local_brick->brick_db_path, PATH_MAX, "%s/%s/%s", rv, GF_HIDDEN_PATH, db_name); @@ -1855,8 +1856,8 @@ tier_init (xlator_t *this) goto out; } - unlink (promotion_qfile); - unlink (demotion_qfile); + sys_unlink(promotion_qfile); + sys_unlink(demotion_qfile); gf_msg (this->name, GF_LOG_INFO, 0, DHT_MSG_LOG_TIER_STATUS, -- cgit