From 23375deb8cf0ebd3e4ea4d4d3bdc5b13130aaa75 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 3 Oct 2008 21:30:04 +0000 Subject: [PATCH] FSCORE-197 unprivileged user setting bigger stack for switch_system thread failure git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9817 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/switch_core.c b/src/switch_core.c index 8675cd33b6..6531804f73 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -758,7 +758,7 @@ SWITCH_DECLARE(void) switch_core_setrlimits(void) #ifndef __FreeBSD__ memset(&rlp, 0, sizeof(rlp)); rlp.rlim_cur = SWITCH_THREAD_STACKSIZE; - rlp.rlim_max = SWITCH_THREAD_STACKSIZE; + rlp.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE; setrlimit(RLIMIT_STACK, &rlp); #endif @@ -1512,7 +1512,9 @@ SWITCH_DECLARE(int) switch_system(const char *cmd, switch_bool_t wait) rlim.rlim_cur = SWITCH_SYSTEM_THREAD_STACKSIZE; rlim.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE; - setrlimit(RLIMIT_STACK, &rlim); + if (setrlimit(RLIMIT_STACK, &rlim) < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed!\n"); + } #endif if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {