From 7fb7ede42224256f6f47fea80b3a7d9d72e98124 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 7 Mar 2009 14:07:48 +0000 Subject: [PATCH] FSCORE-323 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12509 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/switch.c b/src/switch.c index dcabe92ef3..ed5ca6c1b0 100644 --- a/src/switch.c +++ b/src/switch.c @@ -621,13 +621,23 @@ int main(int argc, char *argv[]) memset(&rlp, 0, sizeof(rlp)); getrlimit(RLIMIT_STACK, &rlp); if (rlp.rlim_max > SWITCH_THREAD_STACKSIZE) { + char buf[1024] = ""; + int i = 0; memset(&rlp, 0, sizeof(rlp)); rlp.rlim_cur = SWITCH_THREAD_STACKSIZE; rlp.rlim_max = SWITCH_THREAD_STACKSIZE; setrlimit(RLIMIT_STACK, &rlp); - fprintf(stderr, "Error: stacksize %d is too large: run ulimit -s %d or run %s -waste.\nauto-adjusting stack size for optimal performance....\n", - SWITCH_THREAD_STACKSIZE / 1024, SWITCH_THREAD_STACKSIZE / 1024, argv[0]); - return (int)execv(argv[0], argv); + fprintf(stderr, "Error: stacksize %ld is too large: run ulimit -s %d or run %s -waste.\nauto-adjusting stack size for optimal performance....\n", + rlp.rlim_max / 1024, SWITCH_THREAD_STACKSIZE / 1024, argv[0]); + apr_terminate(); + ret = (int)execv(argv[0], argv); + + for(i = 0; i < argc; i++) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]); + } + + return system(buf); + } } #endif