diff --git a/SRC/echoping.c b/SRC/echoping.c index 0630327..9a3183f 100644 --- a/SRC/echoping.c +++ b/SRC/echoping.c @@ -770,6 +770,18 @@ main (argc, argv) meth = SSLv23_client_method (); if ((ctx = SSL_CTX_new (meth)) == NULL) err_sys ("Cannot create a new SSL context"); + /* Bug reported by Sebastian Siewior + . It seems that OpenSSL crashes + on non blocking sockets when trying to close them (OpenSSL + will try write on a closed socket). */ +#ifdef USE_SIGACTION + mysigaction.sa_handler = SIG_IGN; + sigemptyset (&mysigaction.sa_mask); + if ((sigaction (SIGPIPE, &mysigaction, NULL)) < 0) + ; /* Ignore it */ +#else + signal (SIGPIPE, SIG_IGN); +#endif } #endif #ifdef GNUTLS