X-Git-Url: https://www.bearssl.org/gitweb//home/git/?p=BearSSL;a=blobdiff_plain;f=samples%2Fclient_basic.c;h=31a88be4c128309091bde3e2065ebf416688ce02;hp=d4f79fb752d5bfdb3dbc168b4d9469db11a91b7c;hb=acc70b1be60a6f321e2da618cd35d901b1a598a4;hpb=3210f38e0491b39aec1ef419cb4114e9483089fb diff --git a/samples/client_basic.c b/samples/client_basic.c index d4f79fb..31a88be 100644 --- a/samples/client_basic.c +++ b/samples/client_basic.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -201,7 +202,7 @@ static const unsigned char TA1_EC_Q[] = { static const br_x509_trust_anchor TAs[2] = { { - (unsigned char *)TA0_DN, sizeof TA0_DN, + { (unsigned char *)TA0_DN, sizeof TA0_DN }, BR_X509_TA_CA, { BR_KEYTYPE_RSA, @@ -212,7 +213,7 @@ static const br_x509_trust_anchor TAs[2] = { } }, { - (unsigned char *)TA1_DN, sizeof TA1_DN, + { (unsigned char *)TA1_DN, sizeof TA1_DN }, BR_X509_TA_CA, { BR_KEYTYPE_EC, @@ -260,6 +261,11 @@ main(int argc, char *argv[]) path = "/"; } + /* + * Ignore SIGPIPE to avoid crashing in case of abrupt socket close. + */ + signal(SIGPIPE, SIG_IGN); + /* * Open the socket to the target server. */