diff options
Diffstat (limited to 'libglusterfs/src/run.c')
-rw-r--r-- | libglusterfs/src/run.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c index 6018a58ad5f..cb709546637 100644 --- a/libglusterfs/src/run.c +++ b/libglusterfs/src/run.c @@ -24,6 +24,7 @@ #include <signal.h> #include <sys/wait.h> #include <sys/resource.h> +#include "syscall.h" #ifdef RUN_STANDALONE #define GF_CALLOC(n, s, t) calloc(n, s) @@ -241,18 +242,18 @@ runner_start (runner_t *runner) switch (runner->chpid) { case -1: errno_priv = errno; - close (xpi[0]); - close (xpi[1]); + sys_close (xpi[0]); + sys_close (xpi[1]); for (i = 0; i < 3; i++) { - close (pi[i][0]); - close (pi[i][1]); + sys_close (pi[i][0]); + sys_close (pi[i][1]); } errno = errno_priv; return -1; case 0: for (i = 0; i < 3; i++) - close (pi[i][i ? 0 : 1]); - close (xpi[0]); + sys_close (pi[i][i ? 0 : 1]); + sys_close (xpi[0]); ret = 0; for (i = 0; i < 3; i++) { @@ -278,15 +279,15 @@ runner_start (runner_t *runner) struct dirent *de = NULL; char *e = NULL; - d = opendir ("/proc/self/fd"); + d = sys_opendir ("/proc/self/fd"); if (d) { - while ((de = readdir (d))) { + while ((de = sys_readdir (d))) { i = strtoul (de->d_name, &e, 10); if (*e == '\0' && i > 2 && i != dirfd (d) && i != xpi[1]) - close (i); + sys_close (i); } - closedir (d); + sys_closedir (d); } else ret = -1; #else /* !GF_LINUX_HOST_OS */ @@ -296,7 +297,7 @@ runner_start (runner_t *runner) for (i = 3; i < rl.rlim_cur; i++) { if (i != xpi[1]) - close (i); + sys_close (i); } #endif /* !GF_LINUX_HOST_OS */ } @@ -308,14 +309,14 @@ runner_start (runner_t *runner) execvp (runner->argv[0], runner->argv); } - ret = write (xpi[1], &errno, sizeof (errno)); + ret = sys_write (xpi[1], &errno, sizeof (errno)); _exit (1); } errno_priv = errno; for (i = 0; i < 3; i++) - close (pi[i][i ? 1 : 0]); - close (xpi[1]); + sys_close (pi[i][i ? 1 : 0]); + sys_close (xpi[1]); if (ret == -1) { for (i = 0; i < 3; i++) { if (runner->chio[i]) { @@ -324,8 +325,8 @@ runner_start (runner_t *runner) } } } else { - ret = read (xpi[0], (char *)&errno_priv, sizeof (errno_priv)); - close (xpi[0]); + ret = sys_read (xpi[0], (char *)&errno_priv, sizeof (errno_priv)); + sys_close (xpi[0]); if (ret <= 0) return 0; GF_ASSERT (ret == sizeof (errno_priv)); @@ -371,7 +372,7 @@ runner_end (runner_t *runner) GF_FREE (runner->argv); } for (i = 0; i < 3; i++) - close (runner->chfd[i]); + sys_close (runner->chfd[i]); return ret; } |