New server option -E to choose what to do on oops
Three options: abort, crash-dump, nothing. crash-dump works by aborting a fork. It isn't implemented for Windows. The oops action is no longer tied to daemon mode, but -d still implies -E abort for convenience.
This commit is contained in:
parent
beb8a7ceb4
commit
627e7d452d
4 changed files with 59 additions and 16 deletions
|
@ -46,8 +46,7 @@
|
|||
#include "player.h"
|
||||
#include "prototypes.h"
|
||||
|
||||
/* Debugging? If yes call abort() on internal error. */
|
||||
int debug = 1;
|
||||
enum oops_action oops_action = OOPS_ABORT;
|
||||
|
||||
static char logfile[32];
|
||||
static int logfd = -1;
|
||||
|
@ -133,7 +132,18 @@ int
|
|||
oops(char *msg, char *file, int line)
|
||||
{
|
||||
logerror("Oops: %s in %s:%d", msg ? msg : "bug", file, line);
|
||||
if (debug) abort();
|
||||
switch (oops_action) {
|
||||
case OOPS_ABORT:
|
||||
abort();
|
||||
case OOPS_CRASH_DUMP:
|
||||
#ifndef _WIN32
|
||||
if (fork() == 0)
|
||||
abort();
|
||||
#endif
|
||||
/* fall through */
|
||||
case OOPS_NOTHING:
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue