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 --- geo-replication/src/procdiggy.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'geo-replication/src/procdiggy.c') diff --git a/geo-replication/src/procdiggy.c b/geo-replication/src/procdiggy.c index d9253bbb89e..1ea52c1a6a1 100644 --- a/geo-replication/src/procdiggy.c +++ b/geo-replication/src/procdiggy.c @@ -16,6 +16,7 @@ #include /* for PATH_MAX */ #include "common-utils.h" +#include "syscall.h" #include "procdiggy.h" pid_t @@ -27,7 +28,7 @@ pidinfo (pid_t pid, char **name) char *p = NULL; int ret = 0; - sprintf (path, PROC"/%d/status", pid); + snprintf (path, sizeof path, PROC"/%d/status", pid); f = fopen (path, "r"); if (!f) @@ -89,10 +90,10 @@ prociter (int (*proch) (pid_t pid, pid_t ppid, char *tmpname, void *data), pid_t ppid = -1; int ret = 0; - d = opendir (PROC); + d = sys_opendir (PROC); if (!d) return -1; - while (errno = 0, de = readdir (d)) { + while (errno = 0, de = sys_readdir (d)) { if (gf_string2int (de->d_name, &pid) != -1 && pid >= 0) { ppid = pidinfo (pid, &name); switch (ppid) { @@ -105,7 +106,7 @@ prociter (int (*proch) (pid_t pid, pid_t ppid, char *tmpname, void *data), break; } } - closedir (d); + sys_closedir (d); if (!de && errno) { fprintf (stderr, "failed to traverse "PROC" (%s)\n", strerror (errno)); -- cgit