Introduce a new cmake option that allows graceful shutdown in case of options

master
Lothar Braun 2020-04-26 14:01:23 +02:00
parent 9ff81ed021
commit 4f8d79f3a2
2 changed files with 10 additions and 0 deletions

View File

@ -565,6 +565,12 @@ IF (DISABLE_MEMMANAGER)
ADD_DEFINITIONS(-DIM_DISABLE)
ENDIF (DISABLE_MEMMANAGER)
OPTION(EXIT_ON_EXCEPTION "Thrown exceptions in VERMONT result in a graceful shutdown. Useful for fuzz testing only." OFF)
MARK_AS_ADVANCED(EXIT_ON_EXCEPTION)
IF (EXIT_ON_EXCEPTION)
ADD_DEFINITIONS(-DEXIT_ON_EXCEPTION)
ENDIF(EXIT_ON_EXCEPTION)
### IPFIXLOLIB_RAWDIR_SUPPORT

View File

@ -334,7 +334,11 @@ extern "C" {
msg_expand(text, line, filename, funcname, simplefunc, LOG_CRIT, fmt, &args);
va_end(args);
#ifdef EXIT_ON_EXCEPTION
exit(0);
#else
throw std::runtime_error(text);
#endif
}
#ifdef __cplusplus