If /proc/sys/kernel/core_pattern is configured to store the core dump at root (e.g. it is set to "/core"), get_linux_corepath() just returns what it read in core_pattern. As a result corepath becomes full path to the core dump, and not path to the directory containing the core. Later, on any panic, dump_core() tries to chdir(corepath) and fails (directory /core doesn't exist). As a result core dump is not created at all. Proposed fix: diff --git a/samba/samba-4.0.14/source3/lib/dumpcore.c b/samba/samba-4.0.14/source3/lib/dumpcore.c index 90acc16..93c2e58 100644 --- a/samba/samba-4.0.14/source3/lib/dumpcore.c +++ b/samba/samba-4.0.14/source3/lib/dumpcore.c @@ -175,10 +175,11 @@ static char *get_linux_corepath(void) end = strrchr_m(result, '/'); - if ((end != result) /* this would be the only / */ - && (end != NULL)) { + if (end != result) *end = '\0'; - } + else + result = "/"; + return result; } #endif I think check (end!=NULL) is also not required, at this stage we know result[0] == '/', so strrchr_m(result, '/') can't return NULL.
I'll take a look at this. Jeremy.