SIGPIPE shall be ignored in most network-related cases.
This commit is contained in:
parent
7561e7d6c8
commit
3b044d4296
4 changed files with 24 additions and 0 deletions
|
|
@ -27,6 +27,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
@ -260,6 +261,11 @@ main(int argc, char *argv[])
|
||||||
path = "/";
|
path = "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ignore SIGPIPE to avoid crashing in case of abrupt socket close.
|
||||||
|
*/
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the socket to the target server.
|
* Open the socket to the target server.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
@ -278,6 +279,11 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
port = argv[1];
|
port = argv[1];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ignore SIGPIPE to avoid crashing in case of abrupt socket close.
|
||||||
|
*/
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the server socket.
|
* Open the server socket.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
@ -619,6 +620,11 @@ do_client(int argc, char *argv[])
|
||||||
br_ssl_engine_set_buffer(&cc.eng, iobuf, iobuf_len, bidi);
|
br_ssl_engine_set_buffer(&cc.eng, iobuf, iobuf_len, bidi);
|
||||||
br_ssl_client_reset(&cc, sni, 0);
|
br_ssl_client_reset(&cc, sni, 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to avoid SIGPIPE.
|
||||||
|
*/
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Connect to the peer.
|
* Connect to the peer.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
@ -1010,6 +1011,11 @@ do_server(int argc, char *argv[])
|
||||||
|
|
||||||
br_ssl_engine_set_buffer(&cc.eng, iobuf, iobuf_len, bidi);
|
br_ssl_engine_set_buffer(&cc.eng, iobuf, iobuf_len, bidi);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to ignore SIGPIPE.
|
||||||
|
*/
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open the server socket.
|
* Open the server socket.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue