#endif
static char *corepath;
+static bool using_helper_binary = false;
/**
* Build up the default corepath as "<logbase>/cores/<progname>"
/*
* No absolute path, use the default (cwd)
*/
+ if (result[0] == '|') {
+ /*
+ * Core dump handled by helper binaries
+ */
+ using_helper_binary = true;
+ }
TALLOC_FREE(result);
return NULL;
}
}
if (*corepath != '\0') {
- /* The chdir might fail if we dump core before we finish
- * processing the config file.
+ /*
+ * Check whether coredump is handled by helper binaries or not.
+ * If so skip chdir().
*/
- if (chdir(corepath) != 0) {
- DEBUG(0, ("unable to change to %s\n", corepath));
- DEBUGADD(0, ("refusing to dump core\n"));
- exit(1);
- }
+ if (!using_helper_binary) {
+ /* The chdir might fail if we dump core before we finish
+ * processing the config file.
+ */
+ if (chdir(corepath) != 0) {
+ DEBUG(0, ("unable to change to %s\n", corepath));
+ DEBUGADD(0, ("refusing to dump core\n"));
+ exit(1);
+ }
- DEBUG(0,("dumping core in %s\n", corepath));
+ DEBUG(0,("dumping core in %s\n", corepath));
+ } else {
+ DEBUG(0,("coredump is handled by helper binary "
+ "specified at /proc/sys/kernel/core_pattern"));
+ }
}
umask(~(0700));