From dc8b731c47f138d48032d6693b9270b6bb5f6bdc Mon Sep 17 00:00:00 2001
From: Costa Tsaousis <costa@netdata.cloud>
Date: Wed, 26 Feb 2025 23:07:13 +0000
Subject: [PATCH] minor status file annotation fixes (#19723)

* minor status file annotation fixes

* avoid duplicate cause
---
 src/daemon/daemon-status-file.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/daemon/daemon-status-file.c b/src/daemon/daemon-status-file.c
index 55d1083ba6..f72fea865a 100644
--- a/src/daemon/daemon-status-file.c
+++ b/src/daemon/daemon-status-file.c
@@ -711,16 +711,16 @@ void daemon_status_file_check_crash(void) {
                 msg = "The system was abnormally powered off while Netdata was starting";
                 pri = PRI_USER_SHOULD_FIX;
             }
-            else if (last_session_status.exit_reason &= (EXIT_REASON_SIGBUS|EXIT_REASON_SIGFPE|EXIT_REASON_SIGILL|EXIT_REASON_SIGSEGV)) {
-                cause = "killed signal";
-                msg = "Netdata was last crashed while starting, with a signal indicating a bug";
-                pri = PRI_NETDATA_BUG;
-            }
-            else if (last_session_status.exit_reason &= EXIT_REASON_OUT_OF_MEMORY) {
+            else if (last_session_status.exit_reason & EXIT_REASON_OUT_OF_MEMORY) {
                 cause = "out of memory";
                 msg = "Netdata was last crashed while starting, because it couldn't allocate memory";
                 pri = PRI_USER_SHOULD_FIX;
             }
+            else if (!is_exit_reason_normal(last_session_status.exit_reason)) {
+                cause = "fatal on start";
+                msg = "Netdata was last crashed while starting, because of a fatal error";
+                pri = PRI_NETDATA_BUG;
+            }
             else {
                 cause = "crashed on start";
                 msg = "Netdata was last killed/crashed while starting";
@@ -760,16 +760,16 @@ void daemon_status_file_check_crash(void) {
                 msg = "The system was abnormally powered off while Netdata was running";
                 pri = PRI_USER_SHOULD_FIX;
             }
-            else if (last_session_status.exit_reason &= (EXIT_REASON_SIGBUS|EXIT_REASON_SIGFPE|EXIT_REASON_SIGILL|EXIT_REASON_SIGSEGV)) {
-                cause = "killed signal";
-                msg = "Netdata was last crashed with a signal indicating a bug";
-                pri = PRI_NETDATA_BUG;
-            }
-            else if (last_session_status.exit_reason &= EXIT_REASON_OUT_OF_MEMORY) {
+            else if (last_session_status.exit_reason & EXIT_REASON_OUT_OF_MEMORY) {
                 cause = "out of memory";
                 msg = "Netdata was last crashed because it couldn't allocate memory";
                 pri = PRI_USER_SHOULD_FIX;
             }
+            else if (!is_exit_reason_normal(last_session_status.exit_reason)) {
+                cause = "killed fatal";
+                msg = "Netdata was last crashed due to a fatal error";
+                pri = PRI_NETDATA_BUG;
+            }
             else {
                 cause = "killed hard";
                 msg = "Netdata was last killed/crashed while operating normally";