Skip to content
Snippets Groups Projects
Commit 9396c5a6 authored by Florian Schmaus's avatar Florian Schmaus
Browse files

[Common] Call abort() instead of exit() in die()

Calling abort() has multiple advantages. First, it better matches the
semantic of DIE(_MSG) as it signals an abnormal process termination,
whereas exit() is a normal process termination (even though
potentially with an error exit code). Secondly, abort() throws
SIGABRT, which in turn triggers a coredump, hence the program's state
can be inspected afterwards.
parent 64ba4c05
No related branches found
No related tags found
1 merge request!198[Common] Call abort() instead of exit() in die()
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2020 Florian Schmaus
// Copyright © 2020-2021 Florian Schmaus
#include "Common.hpp"
#include <cstdio>
......@@ -12,5 +12,6 @@ void die(const char* message, bool usePerror) {
} else {
std::cerr << message << std::endl;
}
exit(EXIT_FAILURE);
abort();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment