From: BJ Weschke Date: Tue, 14 Feb 2006 02:41:42 +0000 (+0000) Subject: Make sure that PR_SET_DUMPABLE is set to make certain that we still dump core if... X-Git-Tag: 1.4.0-beta1~2641 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f8017bc22e8384c367fa037499edb57db086b79;p=thirdparty%2Fasterisk.git Make sure that PR_SET_DUMPABLE is set to make certain that we still dump core if Asterisk has setuid'd to run as non-root git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@9844 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/asterisk.c b/asterisk.c index acdaca634f..0da54a21b1 100644 --- a/asterisk.c +++ b/asterisk.c @@ -74,6 +74,7 @@ #include #include #include +#include #include #if defined(__FreeBSD__) || defined( __NetBSD__ ) || defined(SOLARIS) @@ -2191,6 +2192,12 @@ int main(int argc, char *argv[]) #endif /* __CYGWIN__ */ + if (geteuid() && ast_opt_dump_core) { + if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { + ast_log(LOG_WARNING, "Unable to set the process for core dumps after changing to a non-root user. %s\n", strerror(errno)); + } + } + term_init(); printf(term_end()); fflush(stdout);