diff --git a/configure.ac b/configure.ac index a91690aeca..160c79f72a 100644 --- a/configure.ac +++ b/configure.ac @@ -766,7 +766,7 @@ AC_SUBST(LIBTOOL_LIB_EXTEN) # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h sys/select.h netdb.h execinfo.h]) +AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h sys/prctl.h sys/select.h netdb.h execinfo.h]) if test x"$ac_cv_header_wchar_h" = xyes; then HAVE_WCHAR_H_DEFINE=1 diff --git a/src/switch_core.c b/src/switch_core.c index 59682df609..b2216ec2b5 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -51,6 +51,9 @@ #endif #include #include +#ifdef HAVE_SYS_PRCTL_H +#include +#endif SWITCH_DECLARE_DATA switch_directories SWITCH_GLOBAL_dirs = { 0 }; @@ -1029,6 +1032,12 @@ SWITCH_DECLARE(int32_t) change_user_group(const char *user, const char *group) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to change uid!\n"); return -1; } +#ifdef HAVE_SYS_PRCTL_H + if (prctl(PR_SET_DUMPABLE, 1) < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to enable core dumps!\n"); + return -1; + } +#endif } #endif return 0;