]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Set SIGPIPE to SIG_IGN.
authorMagnus Ihse Bursie <mag@icus.se>
Wed, 22 Jan 2025 18:16:50 +0000 (19:16 +0100)
committerMagnus Ihse Bursie <mag@icus.se>
Sun, 27 Jul 2025 21:50:48 +0000 (23:50 +0200)
Signed-off-by: Magnus Ihse Bursie <mag@icus.se>
main.c

diff --git a/main.c b/main.c
index be0e3cd7566a1d4e3e431e93894bfbf77897f42f..8a238195b4f621756f13517637797f2c74d75e65 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1796,6 +1796,7 @@ int main(int argc, char *argv[])
 #endif
 #ifndef _WIN32
        struct sigaction sa;
+       struct sigaction sa_ignore;
        struct utsname utsbuf;
 #endif
 
@@ -2342,6 +2343,7 @@ int main(int argc, char *argv[])
 
 #ifndef _WIN32
        memset(&sa, 0, sizeof(sa));
+       memset(&sa, 0, sizeof(sa_ignore));
 
        sa.sa_handler = handle_signal;
        checked_sigaction(SIGTERM, &sa, NULL);
@@ -2349,6 +2351,9 @@ int main(int argc, char *argv[])
        checked_sigaction(SIGHUP, &sa, NULL);
        checked_sigaction(SIGUSR1, &sa, NULL);
        checked_sigaction(SIGUSR2, &sa, NULL);
+
+       sa_ignore.sa_handler = SIG_IGN;
+       checked_sigaction(SIGPIPE, &sa_ignore, NULL);
 #else /* _WIN32 */
        SetConsoleCtrlHandler(console_ctrl_handler, TRUE /* Add */);
 #endif