Module: sems Branch: master Commit: d9e51e172808051fde696136e40709a74908fc4a URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=d9e51e172808051fde696136e40709a74908fc4a
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Wed Nov 16 17:42:20 2011 +0100 on linux, set PR_SET_DUMPABLE=1 to dump core after setuid --- core/sems.cpp | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/core/sems.cpp b/core/sems.cpp index d34e04a..6ba5108 100644 --- a/core/sems.cpp +++ b/core/sems.cpp @@ -60,6 +60,9 @@ #include <string> using std::string; +#if defined(__linux__) +#include <sys/prctl.h> +#endif const char* progname = NULL; /**< Program name (actually argv[0])*/ int main_pid = 0; /**< Main process PID */ @@ -406,6 +409,14 @@ int main(int argc, char* argv[]) } } +#if defined(__linux__) + if(!AmConfig::DaemonUid.empty() || !AmConfig::DaemonGid.empty()){ + if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0) { + WARN("unable to set daemon to dump core after setuid/setgid\n"); + } + } +#endif + /* fork to become!= group leader*/ int pid; if ((pid=fork())<0){ _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
