Add setrlimit call in -core option to make dumps occur.

Default core size limit for most environments is 0, which disables core
dumps. Add code in the -core option processing path to set the core limit to
the maximum value.
This commit is contained in:
Keith Packard 2007-04-09 12:28:53 -07:00
parent 4beeab8424
commit 4c2e28b091
1 changed files with 8 additions and 0 deletions

View File

@ -64,6 +64,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xos.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "misc.h"
#include <X11/X.h>
#define XSERV_t
@ -795,7 +797,13 @@ ProcessCommandLine(int argc, char *argv[])
UseMsg();
}
else if ( strcmp( argv[i], "-core") == 0)
{
struct rlimit core_limit;
CoreDump = TRUE;
getrlimit (RLIMIT_CORE, &core_limit);
core_limit.rlim_cur = core_limit.rlim_max;
setrlimit (RLIMIT_CORE, &core_limit);
}
else if ( strcmp( argv[i], "-dpi") == 0)
{
if(++i < argc)