# panic_action: Command to execute on server fault.
#
# WARNING: DO NOT SET A PANIC ACTION ON PRODUCTION SERVERS WHICH DOES
-# WARNING: NOT IMMEDIATELY RETURN. DOING SO MAY PREVENT YOUR server
+# WARNING: NOT IMMEDIATELY RETURN. DOING SO MAY PREVENT YOUR SERVER
# WARNING: FROM RESTARTING.
#
# Sets a command which will be executed if the server receives a fatal,
# - %e The currently executing program e.g. /sbin/radiusd
# - %p The PID of the currently executing program e.g. 12345
#
-# Standard ${} syntax substitutions are also allowed.
+# Standard ${} substitutions are also allowed.
#
-# An example for opening an interactive session in GDB would be:
+# An example panic action for opening an interactive session in GDB would be:
#panic_action = "gdb %e %p"
#
-# An example for opening an automated session in GDB would be:
+# An example panic action for opening an automated session in GDB would be:
#panic_action = "gdb -silent -x ${raddbdir}/panic.gdb %e %p > ${logdir}/gdb.log 2>&1"
# max_request_time: The maximum time (in seconds) to handle a request.
* @param cmd to execute on fault. If present %p will be substituted
* for the parent PID before the command is executed, and %e
* will be substituted for the currently running program.
+ * @param program Name of program currently executing (argv[0]).
* @return 0 on success -1 on failure.
*/
int fr_fault_setup(char const *cmd, char const *program)
p = strstr(cmd, "%e");
if (p) {
snprintf(panic_action, sizeof(panic_action), "%.*s%s%s",
- (int)(p - cmd), cmd, program, p + 2);
+ (int)(p - cmd), cmd, program ? program : "", p + 2);
} else {
strlcpy(panic_action, cmd, sizeof(panic_action));
}
int flag = 0;
int from_child[2] = {-1, -1};
+ /*
+ * If the server was built with debugging enabled always install
+ * the basic fatal signal handlers.
+ */
+#ifndef NDEBUG
+ fr_fault_setup(NULL, NULL);
+#endif
#ifdef OSFC2
set_auth_parameters(argc,argv);