From 1ac48a677c57686b7fd45d93304e7de46d6c3fe0 Mon Sep 17 00:00:00 2001 From: jsing Date: Fri, 23 May 2014 16:10:02 +0000 Subject: [PATCH] Calling signal once to ignore SIGPIPE is sufficient - we do not need to do this again in each app. ok miod@ --- lib/libssl/src/apps/asn1pars.c | 2 -- lib/libssl/src/apps/ca.c | 2 -- lib/libssl/src/apps/ciphers.c | 2 -- lib/libssl/src/apps/cms.c | 2 -- lib/libssl/src/apps/crl.c | 2 -- lib/libssl/src/apps/crl2p7.c | 2 -- lib/libssl/src/apps/dgst.c | 2 -- lib/libssl/src/apps/dh.c | 2 -- lib/libssl/src/apps/dhparam.c | 2 -- lib/libssl/src/apps/dsa.c | 2 -- lib/libssl/src/apps/dsaparam.c | 2 -- lib/libssl/src/apps/ec.c | 2 -- lib/libssl/src/apps/ecparam.c | 2 -- lib/libssl/src/apps/enc.c | 2 -- lib/libssl/src/apps/engine.c | 1 - lib/libssl/src/apps/errstr.c | 2 -- lib/libssl/src/apps/gendh.c | 2 -- lib/libssl/src/apps/gendsa.c | 2 -- lib/libssl/src/apps/genrsa.c | 1 - lib/libssl/src/apps/passwd.c | 2 -- lib/libssl/src/apps/pkcs12.c | 2 -- lib/libssl/src/apps/pkcs7.c | 2 -- lib/libssl/src/apps/prime.c | 2 -- lib/libssl/src/apps/rand.c | 2 -- lib/libssl/src/apps/req.c | 1 - lib/libssl/src/apps/rsa.c | 2 -- lib/libssl/src/apps/s_client.c | 1 - lib/libssl/src/apps/s_server.c | 1 - lib/libssl/src/apps/s_time.c | 1 - lib/libssl/src/apps/sess_id.c | 2 -- lib/libssl/src/apps/smime.c | 2 -- lib/libssl/src/apps/speed.c | 1 - lib/libssl/src/apps/spkac.c | 2 -- lib/libssl/src/apps/ts.c | 2 -- lib/libssl/src/apps/verify.c | 2 -- lib/libssl/src/apps/version.c | 2 -- lib/libssl/src/apps/x509.c | 2 -- 37 files changed, 67 deletions(-) diff --git a/lib/libssl/src/apps/asn1pars.c b/lib/libssl/src/apps/asn1pars.c index 2d56487669d..e304f3c88f1 100644 --- a/lib/libssl/src/apps/asn1pars.c +++ b/lib/libssl/src/apps/asn1pars.c @@ -101,8 +101,6 @@ asn1parse_main(int argc, char **argv) informat = FORMAT_PEM; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/ca.c b/lib/libssl/src/apps/ca.c index 8217f36198a..87b5dd15117 100644 --- a/lib/libssl/src/apps/ca.c +++ b/lib/libssl/src/apps/ca.c @@ -299,8 +299,6 @@ ca_main(int argc, char **argv) char *tofree = NULL; DB_ATTR db_attr; - signal(SIGPIPE, SIG_IGN); - conf = NULL; key = NULL; section = NULL; diff --git a/lib/libssl/src/apps/ciphers.c b/lib/libssl/src/apps/ciphers.c index 0e3b8277dac..0e3e62a12e9 100644 --- a/lib/libssl/src/apps/ciphers.c +++ b/lib/libssl/src/apps/ciphers.c @@ -94,8 +94,6 @@ ciphers_main(int argc, char **argv) meth = SSLv3_server_method(); - signal(SIGPIPE, SIG_IGN); - STDout = BIO_new_fp(stdout, BIO_NOCLOSE); if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/cms.c b/lib/libssl/src/apps/cms.c index d85690cf4b6..56a7c95630c 100644 --- a/lib/libssl/src/apps/cms.c +++ b/lib/libssl/src/apps/cms.c @@ -145,8 +145,6 @@ cms_main(int argc, char **argv) args = argv + 1; ret = 1; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/crl.c b/lib/libssl/src/apps/crl.c index 0d17ba91539..89be07a799c 100644 --- a/lib/libssl/src/apps/crl.c +++ b/lib/libssl/src/apps/crl.c @@ -124,8 +124,6 @@ crl_main(int argc, char **argv) int do_ver = 0; const EVP_MD *md_alg, *digest = EVP_sha1(); - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/crl2p7.c b/lib/libssl/src/apps/crl2p7.c index 9d3552ab888..eb6b6f51802 100644 --- a/lib/libssl/src/apps/crl2p7.c +++ b/lib/libssl/src/apps/crl2p7.c @@ -99,8 +99,6 @@ crl2pkcs7_main(int argc, char **argv) STACK_OF(X509) * cert_stack = NULL; int ret = 1, nocrl = 0; - signal(SIGPIPE, SIG_IGN); - infile = NULL; outfile = NULL; informat = FORMAT_PEM; diff --git a/lib/libssl/src/apps/dgst.c b/lib/libssl/src/apps/dgst.c index ce0d643f649..23b7d40cc56 100644 --- a/lib/libssl/src/apps/dgst.c +++ b/lib/libssl/src/apps/dgst.c @@ -129,8 +129,6 @@ dgst_main(int argc, char **argv) char *mac_name = NULL; STACK_OF(OPENSSL_STRING) * sigopts = NULL, *macopts = NULL; - signal(SIGPIPE, SIG_IGN); - if ((buf = (unsigned char *) malloc(BUFSIZE)) == NULL) { BIO_printf(bio_err, "out of memory\n"); goto end; diff --git a/lib/libssl/src/apps/dh.c b/lib/libssl/src/apps/dh.c index e7e6e1d874c..e5983506383 100644 --- a/lib/libssl/src/apps/dh.c +++ b/lib/libssl/src/apps/dh.c @@ -99,8 +99,6 @@ dh_main(int argc, char **argv) char *engine; #endif - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/dhparam.c b/lib/libssl/src/apps/dhparam.c index 3973ad05862..3245e69d754 100644 --- a/lib/libssl/src/apps/dhparam.c +++ b/lib/libssl/src/apps/dhparam.c @@ -165,8 +165,6 @@ dhparam_main(int argc, char **argv) #endif int num = 0, g = 0; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/dsa.c b/lib/libssl/src/apps/dsa.c index c35d15016a5..2f584e8c58d 100644 --- a/lib/libssl/src/apps/dsa.c +++ b/lib/libssl/src/apps/dsa.c @@ -116,8 +116,6 @@ dsa_main(int argc, char **argv) int pvk_encr = 2; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/dsaparam.c b/lib/libssl/src/apps/dsaparam.c index 2c0cfc79896..a4eb5b5dfc0 100644 --- a/lib/libssl/src/apps/dsaparam.c +++ b/lib/libssl/src/apps/dsaparam.c @@ -126,8 +126,6 @@ dsaparam_main(int argc, char **argv) int timebomb = 0; #endif - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/ec.c b/lib/libssl/src/apps/ec.c index 452d73cfdbe..708510dc7d5 100644 --- a/lib/libssl/src/apps/ec.c +++ b/lib/libssl/src/apps/ec.c @@ -103,8 +103,6 @@ ec_main(int argc, char **argv) int asn1_flag = OPENSSL_EC_NAMED_CURVE; int new_asn1_flag = 0; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/ecparam.c b/lib/libssl/src/apps/ecparam.c index 3e8b7237204..46c23a22d14 100644 --- a/lib/libssl/src/apps/ecparam.c +++ b/lib/libssl/src/apps/ecparam.c @@ -136,8 +136,6 @@ ecparam_main(int argc, char **argv) *ec_order = NULL, *ec_cofactor = NULL; unsigned char *buffer = NULL; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/enc.c b/lib/libssl/src/apps/enc.c index 5410dc52a20..cbbaa6ef883 100644 --- a/lib/libssl/src/apps/enc.c +++ b/lib/libssl/src/apps/enc.c @@ -130,8 +130,6 @@ enc_main(int argc, char **argv) #endif const EVP_MD *dgst = NULL; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/engine.c b/lib/libssl/src/apps/engine.c index 07d69263d0c..76db58b0dbf 100644 --- a/lib/libssl/src/apps/engine.c +++ b/lib/libssl/src/apps/engine.c @@ -333,7 +333,6 @@ engine_main(int argc, char **argv) BIO *bio_out = NULL; const char *indent = " "; - signal(SIGPIPE, SIG_IGN); SSL_load_error_strings(); if (!load_config(bio_err, NULL)) diff --git a/lib/libssl/src/apps/errstr.c b/lib/libssl/src/apps/errstr.c index 5c724285a09..7e910a5356c 100644 --- a/lib/libssl/src/apps/errstr.c +++ b/lib/libssl/src/apps/errstr.c @@ -76,8 +76,6 @@ errstr_main(int argc, char **argv) char buf[256]; unsigned long l; - signal(SIGPIPE, SIG_IGN); - SSL_load_error_strings(); if ((argc > 1) && (strcmp(argv[1], "-stats") == 0)) { diff --git a/lib/libssl/src/apps/gendh.c b/lib/libssl/src/apps/gendh.c index 4fd47092dd2..53b09985f75 100644 --- a/lib/libssl/src/apps/gendh.c +++ b/lib/libssl/src/apps/gendh.c @@ -103,8 +103,6 @@ gendh_main(int argc, char **argv) #endif BIO *out = NULL; - signal(SIGPIPE, SIG_IGN); - BN_GENCB_set(&cb, dh_cb, bio_err); if (!load_config(bio_err, NULL)) diff --git a/lib/libssl/src/apps/gendsa.c b/lib/libssl/src/apps/gendsa.c index f4f3fb0a0bd..86e03ed882e 100644 --- a/lib/libssl/src/apps/gendsa.c +++ b/lib/libssl/src/apps/gendsa.c @@ -93,8 +93,6 @@ gendsa_main(int argc, char **argv) char *engine = NULL; #endif - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/genrsa.c b/lib/libssl/src/apps/genrsa.c index 899a99fc444..300b4b0da2d 100644 --- a/lib/libssl/src/apps/genrsa.c +++ b/lib/libssl/src/apps/genrsa.c @@ -114,7 +114,6 @@ genrsa_main(int argc, char **argv) if (!bn) goto err; - signal(SIGPIPE, SIG_IGN); BN_GENCB_set(&cb, genrsa_cb, bio_err); if (!load_config(bio_err, NULL)) diff --git a/lib/libssl/src/apps/passwd.c b/lib/libssl/src/apps/passwd.c index e9d0949d743..ef548c87f8b 100644 --- a/lib/libssl/src/apps/passwd.c +++ b/lib/libssl/src/apps/passwd.c @@ -72,8 +72,6 @@ passwd_main(int argc, char **argv) int usecrypt = 0, use1 = 0, useapr1 = 0; size_t pw_maxlen = 0; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto err; diff --git a/lib/libssl/src/apps/pkcs12.c b/lib/libssl/src/apps/pkcs12.c index 5b85f97568a..f2f1e055443 100644 --- a/lib/libssl/src/apps/pkcs12.c +++ b/lib/libssl/src/apps/pkcs12.c @@ -131,8 +131,6 @@ pkcs12_main(int argc, char **argv) char *engine = NULL; #endif - signal(SIGPIPE, SIG_IGN); - cert_pbe = NID_pbe_WithSHA1And40BitRC2_CBC; enc = EVP_des_ede3_cbc(); diff --git a/lib/libssl/src/apps/pkcs7.c b/lib/libssl/src/apps/pkcs7.c index 57e611f9ee1..f2ca4d337e9 100644 --- a/lib/libssl/src/apps/pkcs7.c +++ b/lib/libssl/src/apps/pkcs7.c @@ -93,8 +93,6 @@ pkcs7_main(int argc, char **argv) char *engine = NULL; #endif - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/prime.c b/lib/libssl/src/apps/prime.c index de8f232851b..983e8b6d3a9 100644 --- a/lib/libssl/src/apps/prime.c +++ b/lib/libssl/src/apps/prime.c @@ -66,8 +66,6 @@ prime_main(int argc, char **argv) BIGNUM *bn = NULL; BIO *bio_out; - signal(SIGPIPE, SIG_IGN); - --argc; ++argv; while (argc >= 1 && **argv == '-') { diff --git a/lib/libssl/src/apps/rand.c b/lib/libssl/src/apps/rand.c index c543e326b23..8606e0a40b7 100644 --- a/lib/libssl/src/apps/rand.c +++ b/lib/libssl/src/apps/rand.c @@ -87,8 +87,6 @@ rand_main(int argc, char **argv) char *engine = NULL; #endif - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto err; diff --git a/lib/libssl/src/apps/req.c b/lib/libssl/src/apps/req.c index d306a17ec66..855f11256f7 100644 --- a/lib/libssl/src/apps/req.c +++ b/lib/libssl/src/apps/req.c @@ -192,7 +192,6 @@ req_main(int argc, char **argv) #ifndef OPENSSL_NO_DES cipher = EVP_des_ede3_cbc(); #endif - signal(SIGPIPE, SIG_IGN); infile = NULL; outfile = NULL; diff --git a/lib/libssl/src/apps/rsa.c b/lib/libssl/src/apps/rsa.c index f651f614d11..d9e90c389e5 100644 --- a/lib/libssl/src/apps/rsa.c +++ b/lib/libssl/src/apps/rsa.c @@ -119,8 +119,6 @@ rsa_main(int argc, char **argv) int pvk_encr = 2; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/s_client.c b/lib/libssl/src/apps/s_client.c index bf4a7e082b7..528864d2655 100644 --- a/lib/libssl/src/apps/s_client.c +++ b/lib/libssl/src/apps/s_client.c @@ -467,7 +467,6 @@ s_client_main(int argc, char **argv) meth = SSLv23_client_method(); - signal(SIGPIPE, SIG_IGN); c_Pause = 0; c_quiet = 0; c_ign_eof = 0; diff --git a/lib/libssl/src/apps/s_server.c b/lib/libssl/src/apps/s_server.c index 99ebee4aa67..b45816b17a5 100644 --- a/lib/libssl/src/apps/s_server.c +++ b/lib/libssl/src/apps/s_server.c @@ -723,7 +723,6 @@ s_server_main(int argc, char *argv[]) local_argc = argc; local_argv = argv; - signal(SIGPIPE, SIG_IGN); s_server_init(); if (!load_config(bio_err, NULL)) diff --git a/lib/libssl/src/apps/s_time.c b/lib/libssl/src/apps/s_time.c index e242037cc81..f41494a04ce 100644 --- a/lib/libssl/src/apps/s_time.c +++ b/lib/libssl/src/apps/s_time.c @@ -317,7 +317,6 @@ s_time_main(int argc, char **argv) char buf[1024 * 8]; int ver; - signal(SIGPIPE, SIG_IGN); s_time_init(); s_time_meth = SSLv23_client_method(); diff --git a/lib/libssl/src/apps/sess_id.c b/lib/libssl/src/apps/sess_id.c index f255f25f1b4..d04c189a7d9 100644 --- a/lib/libssl/src/apps/sess_id.c +++ b/lib/libssl/src/apps/sess_id.c @@ -98,8 +98,6 @@ sess_id_main(int argc, char **argv) int cert = 0, noout = 0, text = 0; const char **pp; - signal(SIGPIPE, SIG_IGN); - informat = FORMAT_PEM; outformat = FORMAT_PEM; diff --git a/lib/libssl/src/apps/smime.c b/lib/libssl/src/apps/smime.c index 69d47ee18f2..fe5d0f597d8 100644 --- a/lib/libssl/src/apps/smime.c +++ b/lib/libssl/src/apps/smime.c @@ -122,8 +122,6 @@ smime_main(int argc, char **argv) args = argv + 1; ret = 1; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/speed.c b/lib/libssl/src/apps/speed.c index d25db09ada9..d7e212178a5 100644 --- a/lib/libssl/src/apps/speed.c +++ b/lib/libssl/src/apps/speed.c @@ -521,7 +521,6 @@ speed_main(int argc, char **argv) usertime = -1; #endif - signal(SIGPIPE, SIG_IGN); memset(results, 0, sizeof(results)); #ifndef OPENSSL_NO_DSA memset(dsa_key, 0, sizeof(dsa_key)); diff --git a/lib/libssl/src/apps/spkac.c b/lib/libssl/src/apps/spkac.c index 33791c6cc6b..24db1b4bed0 100644 --- a/lib/libssl/src/apps/spkac.c +++ b/lib/libssl/src/apps/spkac.c @@ -98,8 +98,6 @@ spkac_main(int argc, char **argv) char *engine = NULL; #endif - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/ts.c b/lib/libssl/src/apps/ts.c index 2674de9a574..df2e179ce02 100644 --- a/lib/libssl/src/apps/ts.c +++ b/lib/libssl/src/apps/ts.c @@ -157,8 +157,6 @@ ts_main(int argc, char **argv) ERR_load_crypto_strings(); - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto cleanup; diff --git a/lib/libssl/src/apps/verify.c b/lib/libssl/src/apps/verify.c index b691460a9e5..209ea9bbf5b 100644 --- a/lib/libssl/src/apps/verify.c +++ b/lib/libssl/src/apps/verify.c @@ -98,8 +98,6 @@ verify_main(int argc, char **argv) ERR_load_crypto_strings(); - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; diff --git a/lib/libssl/src/apps/version.c b/lib/libssl/src/apps/version.c index cac5b6f145a..6c42db0dbb7 100644 --- a/lib/libssl/src/apps/version.c +++ b/lib/libssl/src/apps/version.c @@ -144,8 +144,6 @@ version_main(int argc, char **argv) int cflags = 0, version = 0, date = 0, options = 0, platform = 0, dir = 0; - signal(SIGPIPE, SIG_IGN); - if (argc == 1) version = 1; for (i = 1; i < argc; i++) { diff --git a/lib/libssl/src/apps/x509.c b/lib/libssl/src/apps/x509.c index e77fd4ddd31..eb1e2d3d7ab 100644 --- a/lib/libssl/src/apps/x509.c +++ b/lib/libssl/src/apps/x509.c @@ -211,8 +211,6 @@ x509_main(int argc, char **argv) reqfile = 0; - signal(SIGPIPE, SIG_IGN); - if (!load_config(bio_err, NULL)) goto end; -- 2.20.1