mirror of
https://github.com/samba-team/samba.git
synced 2025-12-11 08:23:49 +03:00
More pstring removal. This one was tricky. I had to add
one horror (pstring_clean_name()) which will have to remain until I've removed all pstrings from the client code. Jeremy.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
#endif
|
||||
|
||||
static void (*cont_fn)(void *);
|
||||
static pstring corepath;
|
||||
static char *corepath;
|
||||
|
||||
/*******************************************************************
|
||||
report a fault
|
||||
@@ -93,11 +93,13 @@ make all the preparations to safely dump a core file
|
||||
|
||||
void dump_core_setup(const char *progname)
|
||||
{
|
||||
pstring logbase;
|
||||
char * end;
|
||||
char *logbase = NULL;
|
||||
char *end = NULL;
|
||||
|
||||
if (lp_logfile() && *lp_logfile()) {
|
||||
snprintf(logbase, sizeof(logbase), "%s", lp_logfile());
|
||||
if (asprintf(&logbase, "%s", lp_logfile()) < 0) {
|
||||
return;
|
||||
}
|
||||
if ((end = strrchr_m(logbase, '/'))) {
|
||||
*end = '\0';
|
||||
}
|
||||
@@ -106,21 +108,32 @@ void dump_core_setup(const char *progname)
|
||||
* line by the -l option but the "log file" option is not set
|
||||
* in smb.conf.
|
||||
*/
|
||||
snprintf(logbase, sizeof(logbase), "%s", dyn_LOGFILEBASE);
|
||||
if (asprintf(&logbase, "%s", dyn_LOGFILEBASE) < 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SMB_ASSERT(progname != NULL);
|
||||
|
||||
snprintf(corepath, sizeof(corepath), "%s/cores", logbase);
|
||||
if (asprintf(&corepath, "%s/cores", logbase) < 0) {
|
||||
SAFE_FREE(logbase);
|
||||
return;
|
||||
}
|
||||
mkdir(corepath,0700);
|
||||
|
||||
snprintf(corepath, sizeof(corepath), "%s/cores/%s",
|
||||
logbase, progname);
|
||||
SAFE_FREE(corepath);
|
||||
if (asprintf(&corepath, "%s/cores/%s",
|
||||
logbase, progname) < 0) {
|
||||
SAFE_FREE(logbase);
|
||||
return;
|
||||
}
|
||||
mkdir(corepath,0700);
|
||||
|
||||
sys_chown(corepath,getuid(),getgid());
|
||||
chmod(corepath,0700);
|
||||
|
||||
SAFE_FREE(corepath);
|
||||
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
#ifdef RLIMIT_CORE
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user