From 573a1b3f41aeb831919a472315b1cd48fe3999bf Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Thu, 30 Oct 2014 10:54:24 +0100 Subject: Use F_CLOSEM if available Use F_CLOSEM to close all file descriptors if available. Backport of Ib3c682825b89c163ebb152848f2533b3cb62cdce BUG: 1138897 Change-Id: Ie44c8e07c77ca5509766e0addbb17c1979df68e7 Signed-off-by: Emmanuel Dreyfus Reviewed-on: http://review.gluster.org/9010 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- libglusterfs/src/run.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c index 4fd2a3a0d79..93fe12aed10 100644 --- a/libglusterfs/src/run.c +++ b/libglusterfs/src/run.c @@ -289,7 +289,10 @@ runner_start (runner_t *runner) closedir (d); } else ret = -1; -#else +#else /* !GF_LINUX_HOST_OS */ +#ifdef F_CLOSEM /* NetBSD */ + (void)fcntl(3, F_CLOSEM); +#else /* !F_CLOSEM */ struct rlimit rl; ret = getrlimit (RLIMIT_NOFILE, &rl); GF_ASSERT (ret == 0); @@ -298,7 +301,8 @@ runner_start (runner_t *runner) if (i != xpi[1]) close (i); } -#endif +#endif /* !F_CLOSEM */ +#endif /* !GF_LINUX_HOST_OS */ } if (ret != -1) { -- cgit