From 1b6f168c3d3ff999d72a00f2b7afcf79cc13185f Mon Sep 17 00:00:00 2001 From: Andrey Borodin Date: Tue, 10 Mar 2020 15:22:26 +0500 Subject: [PATCH] Do not use abort() in frontend code (#131) * Do not use abort() in frontend code * Do not abort() on known but erroneous statuses --- sources/frontend.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sources/frontend.c b/sources/frontend.c index 75756a24..47478fed 100644 --- a/sources/frontend.c +++ b/sources/frontend.c @@ -879,10 +879,18 @@ od_frontend_cleanup(od_client_t *client, char *context, /* close backend connection */ od_router_close(router, client); break; - - default: - abort(); - break; + case OD_UNDEF: + case OD_SKIP: + case OD_ATTACH: + case OD_DETACH: + od_error(&instance->logger, context, client, server, + "%s", "unexpected error status %s (%d)", od_status_to_str(status), (uint32)status); + od_router_close(router, client); + break; + default: + od_error(&instance->logger, context, client, server, + "%s", "unexpected error status %s (%d), possible corruption, abort()", od_status_to_str(status), (uint32)status); + abort(); } }