This is an automated email from Gerrit.

"Anatoly P <[email protected]>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/9785

-- gerrit

commit c56cf4c464580cce39bdb3990f602adc20dff00a
Author: Anatoly Parshintsev <[email protected]>
Date:   Thu Jul 16 09:22:40 2026 +0300

    server: defer logging outside signal handlers
    
    Move terminating-signal logging to normal server context because LOG_DEBUG()
    is not async-signal-safe. Drop logging for ignored signals.
    
    Change-Id: I12531c4ec59482bf48a8d26d74b381598a474e95
    Signed-off-by: Anatoly Parshintsev <[email protected]>

diff --git a/src/server/server.c b/src/server/server.c
index 1b12162251..ffcdbb189a 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -603,6 +603,10 @@ int server_loop(struct command_context *command_context)
 #endif
        }
 
+       if (async_shutdown_reason == ASYNC_SHUTDOWN_WITH_SIGNAL)
+               LOG_DEBUG("Terminating on Signal %d",
+                       (int)async_shutdown_last_signal);
+
        /* when quit for signal or CTRL-C, run (eventually user implemented) 
"shutdown" */
        if (async_shutdown_reason != ASYNC_SHUTDOWN_NONE)
                command_run_line(command_context, "shutdown");
@@ -616,9 +620,6 @@ static void sig_handler(int sig)
        if (async_shutdown_reason == ASYNC_SHUTDOWN_NONE) {
                async_shutdown_last_signal = sig;
                async_shutdown_reason = ASYNC_SHUTDOWN_WITH_SIGNAL;
-               LOG_DEBUG("Terminating on Signal %d", sig);
-       } else {
-               LOG_DEBUG("Ignored extra Signal %d", sig);
        }
 }
 
@@ -637,8 +638,6 @@ static void sigkey_handler(int sig)
 
        if (tcgetpgrp(STDIN_FILENO) > 0)
                sig_handler(sig);
-       else
-               LOG_DEBUG("Ignored Signal %d", sig);
 }
 #endif
 

-- 

Reply via email to