[calamares] Improve "crash self" functionality

Instead of UB, use POSIX signals and terminate the Calamares
process with a recognizable signal number (TRAP, which is
highly unusual).
This commit is contained in:
Adriaan de Groot 2024-02-27 00:08:01 +01:00
parent 2555b5baf4
commit 9925d6666f

View File

@ -33,14 +33,15 @@
#include <QTreeView> #include <QTreeView>
#include <QWidget> #include <QWidget>
#include <signal.h>
/** /**
* @brief crash makes Calamares crash immediately. * @brief crash makes Calamares crash immediately.
*/ */
static void static void
crash() crash()
{ {
volatile int* a = nullptr; kill(getpid(), SIGTRAP);
*a = 1;
} }
/// @brief Print out the widget tree (names) in indented form. /// @brief Print out the widget tree (names) in indented form.