aboutsummaryrefslogtreecommitdiffstats
path: root/main/app.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-06 07:01:06 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-06 07:01:06 +0000
commit7c77f7803fc3ab41abd294d6b1cdc9f18aeea8b8 (patch)
treeb799f8033426c336f40d0313064953d43136afa2 /main/app.c
parent16c9e2051f62daedbdabe5dfda0ceef811e00153 (diff)
Move implementation of closefrom(3) from app.c to strcompat.c
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@233358 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/app.c')
-rw-r--r--main/app.c19
1 files changed, 0 insertions, 19 deletions
diff --git a/main/app.c b/main/app.c
index 1c17984f4..4e357ab9d 100644
--- a/main/app.c
+++ b/main/app.c
@@ -33,8 +33,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <regex.h>
#include <sys/file.h> /* added this to allow to compile, sorry! */
#include <signal.h>
-#include <sys/time.h> /* for getrlimit(2) */
-#include <sys/resource.h> /* for getrlimit(2) */
#include <stdlib.h> /* for closefrom(3) */
#ifdef HAVE_CAP
#include <sys/capability.h>
@@ -2008,24 +2006,7 @@ int ast_str_get_encoded_str(struct ast_str **str, int maxlen, const char *stream
void ast_close_fds_above_n(int n)
{
-#ifdef HAVE_CLOSEFROM
closefrom(n + 1);
-#else
- int x, null;
- struct rlimit rl;
- getrlimit(RLIMIT_NOFILE, &rl);
- null = open("/dev/null", O_RDONLY);
- for (x = n + 1; x < rl.rlim_cur; x++) {
- if (x != null) {
- /* Side effect of dup2 is that it closes any existing fd without error.
- * This prevents valgrind and other debugging tools from sending up
- * false error reports. */
- while (dup2(null, x) < 0 && errno == EINTR);
- close(x);
- }
- }
- close(null);
-#endif
}
int ast_safe_fork(int stop_reaper)