diff --git a/src/main.c b/src/main.c index e08f538..ff91a37 100644 --- a/src/main.c +++ b/src/main.c @@ -1773,6 +1773,15 @@ int main(int argc, char *argv[]) { (void)signal(SIGINT, handle_signal); (void)signal(SIGTERM, handle_signal); + /* + * Ignore SIGPIPE so that writing to a socket whose peer has closed returns + * EPIPE instead of killing the signer process. A long-running attended + * signer must survive clients that disconnect abruptly (e.g. the + * nostr_core_lib client reconnects per request, so it closes the previous + * connection; if the server happens to write while the peer is closing, + * SIGPIPE would otherwise terminate the whole signer). + */ + (void)signal(SIGPIPE, SIG_IGN); { char fips_ipv6[128]; @@ -1849,8 +1858,8 @@ int main(int argc, char *argv[]) { } memset(&g_activity_log, 0, sizeof(g_activity_log)); - g_auto_approve = 0; - server_set_prompt_always_allow(0); + g_auto_approve = allow_all ? 1 : 0; + server_set_prompt_always_allow(g_auto_approve); { main_tui_context_t main_tui_ctx; main_tui_ctx.role_table = &role_table;