aboutsummaryrefslogtreecommitdiffstats
path: root/asterisk.c
diff options
context:
space:
mode:
authorbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-14 02:41:42 +0000
committerbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-02-14 02:41:42 +0000
commit2c700e7baee5d3df2472f86a4bf31cb0cf302acb (patch)
treea82843a5f652032b7bc38804e694c109e6e566a4 /asterisk.c
parent79777546da12bae4eca40d206b2d15404b7c3d6a (diff)
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: http://svn.digium.com/svn/asterisk/trunk@9844 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rw-r--r--asterisk.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/asterisk.c b/asterisk.c
index acdaca634..0da54a21b 100644
--- a/asterisk.c
+++ b/asterisk.c
@@ -74,6 +74,7 @@
#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
+#include <sys/prctl.h>
#include <regex.h>
#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);