Hi all,

maybe some of you have noticed that no coredumps are possible any more
when running openpbx as non-root. This is because linux disables 'dumpable'
when doing setuid() and friends.
The patch I already added resets this 'dumpable' flag.
But this may work on linux only and maybe some defines are needed
to make it compilable for other platforms.
Since I cannot test this, I hope someone else can have a look?

thanks,
Armin

On Mon, 13 Feb 2006 [EMAIL PROTECTED] wrote:
> Author: armin
> Date: 2006-02-13 10:47:38 -0500 (Mon, 13 Feb 2006)
> New Revision: 1371
> 
> Modified:
>    openpbx/trunk/corelib/openpbx.c
> Log:
> Added prctl() to set dumpable again, which is removed when using
> setuid() and friends. So now coredumps are produced again.
> 
> 
> Modified: openpbx/trunk/corelib/openpbx.c
> ===================================================================
> --- openpbx/trunk/corelib/openpbx.c   2006-02-13 15:29:09 UTC (rev 1370)
> +++ openpbx/trunk/corelib/openpbx.c   2006-02-13 15:47:38 UTC (rev 1371)
> @@ -72,6 +72,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)
> @@ -2138,6 +2139,14 @@
>  
>  #endif
>  
> +     /* after set*id() the dumpable flag is deleted,
> +        so we set it again to get core dumps */
> +     if (option_dumpcore) {
> +             if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) {
> +                     opbx_log(LOG_ERROR, "Unable to set dumpable flag: 
> %s\n", strerror(errno));
> +             }
> +     }
> +
>       opbx_term_init();
>       printf(opbx_term_end());
>       fflush(stdout);
> 
> _______________________________________________
> Openpbx-svn mailing list
> [EMAIL PROTECTED]
> http://lists.openpbx.org/mailman/listinfo/openpbx-svn
> 
_______________________________________________
Openpbx-dev mailing list
[email protected]
http://lists.openpbx.org/mailman/listinfo/openpbx-dev

Reply via email to