Fix abort_conf processing.

When abort_conf is set, make sure we always error out at the end of the options
processing loop.
This commit is contained in:
Qi Wang 2018-04-17 14:26:26 -07:00 committed by Qi Wang
parent 0fadf4a2e3
commit e40b2f75bd

View File

@ -849,10 +849,8 @@ malloc_conf_error(const char *msg, const char *k, size_t klen, const char *v,
size_t vlen) { size_t vlen) {
malloc_printf("<jemalloc>: %s: %.*s:%.*s\n", msg, (int)klen, k, malloc_printf("<jemalloc>: %s: %.*s:%.*s\n", msg, (int)klen, k,
(int)vlen, v); (int)vlen, v);
/* If abort_conf is set, error out after processing all options. */
had_conf_error = true; had_conf_error = true;
if (opt_abort_conf) {
malloc_abort_invalid_conf();
}
} }
static void static void
@ -1052,9 +1050,6 @@ malloc_conf_init(void) {
CONF_HANDLE_BOOL(opt_abort, "abort") CONF_HANDLE_BOOL(opt_abort, "abort")
CONF_HANDLE_BOOL(opt_abort_conf, "abort_conf") CONF_HANDLE_BOOL(opt_abort_conf, "abort_conf")
if (opt_abort_conf && had_conf_error) {
malloc_abort_invalid_conf();
}
if (strncmp("metadata_thp", k, klen) == 0) { if (strncmp("metadata_thp", k, klen) == 0) {
int i; int i;
bool match = false; bool match = false;
@ -1243,6 +1238,9 @@ malloc_conf_init(void) {
#undef CONF_HANDLE_SSIZE_T #undef CONF_HANDLE_SSIZE_T
#undef CONF_HANDLE_CHAR_P #undef CONF_HANDLE_CHAR_P
} }
if (opt_abort_conf && had_conf_error) {
malloc_abort_invalid_conf();
}
} }
atomic_store_b(&log_init_done, true, ATOMIC_RELEASE); atomic_store_b(&log_init_done, true, ATOMIC_RELEASE);
} }