it was tested with an LSB compiler, but I can add the ifndef before 
pushing. /Thanks HansN

On 04/27/2015 01:20 PM, Anders Widell wrote:
> Ack.
>
> Question: Did you try this with an LSB compiler? I am surprised it 
> didn't complain about PR_SET_DUMPABLE. Maybe it would be good to add 
> an #ifndef, just in case:
>
> #ifndef PR_SET_DUMPABLE
> #define PR_SET_DUMPABLE 4
> #endif
>
> / Anders Widell
>
> On 04/20/2015 02:52 PM, Hans Nordeback wrote:
>>   osaf/libs/core/common/daemon.c |  12 ++++++++++++
>>   1 files changed, 12 insertions(+), 0 deletions(-)
>>
>>
>> diff --git a/osaf/libs/core/common/daemon.c 
>> b/osaf/libs/core/common/daemon.c
>> --- a/osaf/libs/core/common/daemon.c
>> +++ b/osaf/libs/core/common/daemon.c
>> @@ -48,6 +48,8 @@
>>   #include <sys/types.h>
>>   #include <time.h>
>>   +#include <sys/prctl.h>
>> +
>>   #define DEFAULT_RUNAS_USERNAME    "opensaf"
>>     static const char* internal_version_id_;
>> @@ -206,6 +208,9 @@ static void __parse_options(int argc, ch
>>     void daemonize(int argc, char *argv[])
>>   {
>> +#ifndef RUNASROOT
>> +    static int (*plibc_prctl) (int option, ...) = NULL;
>> +#endif
>>       pid_t pid, sid;
>>       struct sched_param param;
>>       char *thread_prio;
>> @@ -349,6 +354,13 @@ void daemonize(int argc, char *argv[])
>>                   syslog(LOG_ERR, "setuid failed, uid=%d (%s)", 
>> pw->pw_uid, strerror(errno));
>>                   exit(EXIT_FAILURE);
>>               }
>> +            // Enable generating core files
>> +            plibc_prctl = dlsym(RTLD_DEFAULT, "prctl");
>> +            if (plibc_prctl) {
>> +                if (plibc_prctl(PR_SET_DUMPABLE, 1) < 0) {
>> +                    syslog(LOG_ERR, "prctl failed: %s", 
>> strerror(errno));
>> +                }
>> +            }
>>           } else {
>>               syslog(LOG_ERR, "invalid user name %s", __runas_username);
>>               exit(EXIT_FAILURE);
>


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to