This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 2a0de9ac2d4933a4cd6d10b7e4705467f6e2a2e8 Author: Marco Casaroli <[email protected]> AuthorDate: Sun Oct 18 12:58:01 2026 +0200 netutils/dhcpc: Use a handler for SIGQUIT in dhcpc_cancel(). dhcpc_cancel() set SIGQUIT to SIG_IGN and sent it to the thread of dhcpc_run() to break it out of a blocking call. An ignored signal need not interrupt that call, and with CONFIG_SIG_DISCARD_IGNORED it does not. Set an empty handler instead of SIG_IGN. The handler also keeps SIGQUIT from terminating the process, as SIG_IGN did. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- netutils/dhcpc/dhcpc.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/netutils/dhcpc/dhcpc.c b/netutils/dhcpc/dhcpc.c index 281a96ebd..c882e213d 100644 --- a/netutils/dhcpc/dhcpc.c +++ b/netutils/dhcpc/dhcpc.c @@ -45,6 +45,7 @@ #include <inttypes.h> #include <stdlib.h> #include <stdint.h> +#include <signal.h> #include <string.h> #include <unistd.h> #include <errno.h> @@ -157,6 +158,21 @@ static const uint8_t magic_cookie[4] = * Private Functions ****************************************************************************/ +#ifdef CONFIG_ENABLE_ALL_SIGNALS +/**************************************************************************** + * Name: dhcpc_wakeup + * + * Description: + * An empty handler for SIGQUIT. dhcpc_cancel() sends SIGQUIT to break + * dhcpc_run() out of recv(); an ignored signal need not interrupt recv(). + * + ****************************************************************************/ + +static void dhcpc_wakeup(int signo) +{ +} +#endif + /**************************************************************************** * Name: dhcpc_add<option> ****************************************************************************/ @@ -757,7 +773,7 @@ void dhcpc_cancel(FAR void *handle) if (pdhcpc->thread) { #ifdef CONFIG_ENABLE_ALL_SIGNALS - old = signal(SIGQUIT, SIG_IGN); + old = signal(SIGQUIT, dhcpc_wakeup); /* Signal the dhcpc_run */
