From 1c3e8bbfedcd3822aeb1bab22fb56c5ecff4295b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 14 Dec 2016 01:29:44 +0100 Subject: checksrc: warn for assignments within if() expressions ... they're already frowned upon in our source code style guide, this now enforces the rule harder. --- tests/libtest/lib1515.c | 3 ++- tests/libtest/lib1520.c | 3 ++- tests/libtest/lib1525.c | 3 ++- tests/libtest/lib1526.c | 3 ++- tests/libtest/lib1527.c | 3 ++- tests/libtest/lib1528.c | 3 ++- tests/libtest/lib1529.c | 5 +++-- tests/libtest/lib1530.c | 5 +++-- tests/libtest/lib1533.c | 3 ++- tests/libtest/lib500.c | 3 ++- tests/libtest/lib501.c | 3 ++- tests/libtest/lib506.c | 12 ++++++++---- tests/libtest/lib508.c | 3 ++- tests/libtest/lib509.c | 3 ++- tests/libtest/lib510.c | 3 ++- tests/libtest/lib511.c | 3 ++- tests/libtest/lib513.c | 3 ++- tests/libtest/lib514.c | 3 ++- tests/libtest/lib515.c | 3 ++- tests/libtest/lib516.c | 3 ++- tests/libtest/lib518.c | 3 ++- tests/libtest/lib519.c | 3 ++- tests/libtest/lib520.c | 3 ++- tests/libtest/lib521.c | 3 ++- tests/libtest/lib523.c | 3 ++- tests/libtest/lib524.c | 3 ++- tests/libtest/lib537.c | 3 ++- tests/libtest/lib539.c | 3 ++- tests/libtest/lib541.c | 3 ++- tests/libtest/lib542.c | 3 ++- tests/libtest/lib543.c | 3 ++- tests/libtest/lib544.c | 3 ++- tests/libtest/lib547.c | 3 ++- tests/libtest/lib549.c | 3 ++- tests/libtest/lib552.c | 3 ++- tests/libtest/lib553.c | 3 ++- tests/libtest/lib554.c | 3 ++- tests/libtest/lib556.c | 3 ++- tests/libtest/lib562.c | 3 ++- tests/libtest/lib566.c | 3 ++- tests/libtest/lib567.c | 3 ++- tests/libtest/lib568.c | 15 ++++++++++----- tests/libtest/lib569.c | 9 ++++++--- tests/libtest/lib570.c | 12 ++++++++---- tests/libtest/lib571.c | 15 ++++++++++----- tests/libtest/lib572.c | 18 ++++++++++++------ tests/libtest/lib574.c | 3 ++- tests/libtest/lib578.c | 3 ++- tests/libtest/lib579.c | 3 ++- tests/libtest/lib586.c | 9 ++++++--- tests/libtest/lib590.c | 3 ++- tests/libtest/lib598.c | 3 ++- tests/libtest/lib599.c | 3 ++- tests/libtest/libauthretry.c | 7 ++++--- tests/server/getpart.c | 9 ++++++--- tests/server/rtspd.c | 18 ++++++++++++------ tests/server/sockfilt.c | 18 ++++++++++++------ tests/server/sws.c | 18 ++++++++++++------ tests/server/tftpd.c | 15 ++++++++++----- tests/unit/unit1305.c | 9 ++++++--- 60 files changed, 216 insertions(+), 110 deletions(-) (limited to 'tests') diff --git a/tests/libtest/lib1515.c b/tests/libtest/lib1515.c index aeaf6b25e..7763c2233 100644 --- a/tests/libtest/lib1515.c +++ b/tests/libtest/lib1515.c @@ -136,7 +136,8 @@ int test(char *URL) "http://testserver.example.com:%s/%s%04d", port, path, i); /* second request must succeed like the first one */ - if((res = do_one_request(multi, target_url, dns_entry))) + res = do_one_request(multi, target_url, dns_entry); + if(res) goto test_cleanup; if(i < count) diff --git a/tests/libtest/lib1520.c b/tests/libtest/lib1520.c index a4ce79b50..4d5b0c88c 100644 --- a/tests/libtest/lib1520.c +++ b/tests/libtest/lib1520.c @@ -81,7 +81,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1525.c b/tests/libtest/lib1525.c index c58ebeda9..39d51bb11 100644 --- a/tests/libtest/lib1525.c +++ b/tests/libtest/lib1525.c @@ -56,7 +56,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1526.c b/tests/libtest/lib1526.c index ef66a484d..b2d2a4118 100644 --- a/tests/libtest/lib1526.c +++ b/tests/libtest/lib1526.c @@ -54,7 +54,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1527.c b/tests/libtest/lib1527.c index f008cf1e4..5dec7fcc0 100644 --- a/tests/libtest/lib1527.c +++ b/tests/libtest/lib1527.c @@ -55,7 +55,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1528.c b/tests/libtest/lib1528.c index 09af481f4..a130c49af 100644 --- a/tests/libtest/lib1528.c +++ b/tests/libtest/lib1528.c @@ -37,7 +37,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1529.c b/tests/libtest/lib1529.c index 3333ae698..c63a109b8 100644 --- a/tests/libtest/lib1529.c +++ b/tests/libtest/lib1529.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -36,7 +36,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1530.c b/tests/libtest/lib1530.c index d1ca34c2a..6fc69f251 100644 --- a/tests/libtest/lib1530.c +++ b/tests/libtest/lib1530.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2015, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -46,7 +46,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib1533.c b/tests/libtest/lib1533.c index de403e195..ada94b940 100644 --- a/tests/libtest/lib1533.c +++ b/tests/libtest/lib1533.c @@ -136,7 +136,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(curl == NULL) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c index 43b05982c..d17b24b20 100644 --- a/tests/libtest/lib500.c +++ b/tests/libtest/lib500.c @@ -68,7 +68,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib501.c b/tests/libtest/lib501.c index 2a105f0cd..7a2341246 100644 --- a/tests/libtest/lib501.c +++ b/tests/libtest/lib501.c @@ -35,7 +35,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c index 32995e1db..20d94877c 100644 --- a/tests/libtest/lib506.c +++ b/tests/libtest/lib506.c @@ -195,7 +195,8 @@ int test(char *URL) /* prepare share */ printf("SHARE_INIT\n"); - if((share = curl_share_init()) == NULL) { + share = curl_share_init(); + if(!share) { fprintf(stderr, "curl_share_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -230,7 +231,8 @@ int test(char *URL) } /* initial cookie manipulation */ - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); @@ -275,7 +277,8 @@ int test(char *URL) /* fetch a another one and save cookies */ printf("*** run %d\n", i); - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); @@ -302,7 +305,8 @@ int test(char *URL) curl_slist_free_all(headers); /* load cookies */ - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); diff --git a/tests/libtest/lib508.c b/tests/libtest/lib508.c index cb60ce1bd..1f6c6838a 100644 --- a/tests/libtest/lib508.c +++ b/tests/libtest/lib508.c @@ -62,7 +62,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib509.c b/tests/libtest/lib509.c index 085a9753e..a2522eb85 100644 --- a/tests/libtest/lib509.c +++ b/tests/libtest/lib509.c @@ -122,7 +122,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib510.c b/tests/libtest/lib510.c index cb5296ec3..68588cfe6 100644 --- a/tests/libtest/lib510.c +++ b/tests/libtest/lib510.c @@ -68,7 +68,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib511.c b/tests/libtest/lib511.c index 0b7ae6f43..2467bf0b0 100644 --- a/tests/libtest/lib511.c +++ b/tests/libtest/lib511.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib513.c b/tests/libtest/lib513.c index 58091ef6a..7c34bc4db 100644 --- a/tests/libtest/lib513.c +++ b/tests/libtest/lib513.c @@ -42,7 +42,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib514.c b/tests/libtest/lib514.c index f516d0942..7b33d52f9 100644 --- a/tests/libtest/lib514.c +++ b/tests/libtest/lib514.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c index d3e6e446a..6fb178720 100644 --- a/tests/libtest/lib515.c +++ b/tests/libtest/lib515.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib516.c b/tests/libtest/lib516.c index 9faf262c6..00c54c450 100644 --- a/tests/libtest/lib516.c +++ b/tests/libtest/lib516.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c index e37a7771d..960fcfca2 100644 --- a/tests/libtest/lib518.c +++ b/tests/libtest/lib518.c @@ -489,7 +489,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); close_file_descriptors(); curl_global_cleanup(); diff --git a/tests/libtest/lib519.c b/tests/libtest/lib519.c index 6e3059892..5c55aebe6 100644 --- a/tests/libtest/lib519.c +++ b/tests/libtest/lib519.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib520.c b/tests/libtest/lib520.c index b5a71da27..72b0875ed 100644 --- a/tests/libtest/lib520.c +++ b/tests/libtest/lib520.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib521.c b/tests/libtest/lib521.c index 40f4def4f..b7efca0be 100644 --- a/tests/libtest/lib521.c +++ b/tests/libtest/lib521.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib523.c b/tests/libtest/lib523.c index f3264690d..44aa2e2e9 100644 --- a/tests/libtest/lib523.c +++ b/tests/libtest/lib523.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib524.c b/tests/libtest/lib524.c index 3440562b2..08fd34dfc 100644 --- a/tests/libtest/lib524.c +++ b/tests/libtest/lib524.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c index c1561419a..6d7c3e40f 100644 --- a/tests/libtest/lib537.c +++ b/tests/libtest/lib537.c @@ -491,7 +491,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); close_file_descriptors(); curl_global_cleanup(); diff --git a/tests/libtest/lib539.c b/tests/libtest/lib539.c index beee91401..7c03dd2fd 100644 --- a/tests/libtest/lib539.c +++ b/tests/libtest/lib539.c @@ -35,7 +35,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib541.c b/tests/libtest/lib541.c index 604446a2e..3e9cb3ccd 100644 --- a/tests/libtest/lib541.c +++ b/tests/libtest/lib541.c @@ -79,7 +79,8 @@ int test(char *URL) } /* get a curl handle */ - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); fclose(hd_src); diff --git a/tests/libtest/lib542.c b/tests/libtest/lib542.c index c82ccd5b7..4016874e1 100644 --- a/tests/libtest/lib542.c +++ b/tests/libtest/lib542.c @@ -42,7 +42,8 @@ int test(char *URL) } /* get a curl handle */ - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c index 90aed2193..6d2532d12 100644 --- a/tests/libtest/lib543.c +++ b/tests/libtest/lib543.c @@ -36,7 +36,8 @@ int test(char *URL) char *s; (void)URL; - if((easy = curl_easy_init()) == NULL) { + easy = curl_easy_init(); + if(!easy) { fprintf(stderr, "curl_easy_init() failed\n"); return TEST_ERR_MAJOR_BAD; } diff --git a/tests/libtest/lib544.c b/tests/libtest/lib544.c index 4b08a0a76..28eacdaf6 100644 --- a/tests/libtest/lib544.c +++ b/tests/libtest/lib544.c @@ -47,7 +47,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib547.c b/tests/libtest/lib547.c index 4ec42a330..ce967c085 100644 --- a/tests/libtest/lib547.c +++ b/tests/libtest/lib547.c @@ -90,7 +90,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib549.c b/tests/libtest/lib549.c index 137029548..1d832b536 100644 --- a/tests/libtest/lib549.c +++ b/tests/libtest/lib549.c @@ -38,7 +38,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c index ae2e691f1..967e21141 100644 --- a/tests/libtest/lib552.c +++ b/tests/libtest/lib552.c @@ -172,7 +172,8 @@ int test(char *URL) config.trace_ascii = 1; /* enable ascii tracing */ - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c index 9afaad48f..288f4c1d1 100644 --- a/tests/libtest/lib553.c +++ b/tests/libtest/lib553.c @@ -67,7 +67,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c index 803df26d1..083746243 100644 --- a/tests/libtest/lib554.c +++ b/tests/libtest/lib554.c @@ -162,7 +162,8 @@ static int once(char *URL, bool oldstyle) if(formrc) printf("curl_formadd(4) = %d\n", (int)formrc); - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_formfree(formpost); curl_global_cleanup(); diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c index 527935396..a26101940 100644 --- a/tests/libtest/lib556.c +++ b/tests/libtest/lib556.c @@ -45,7 +45,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib562.c b/tests/libtest/lib562.c index 819b50759..285b9f5d0 100644 --- a/tests/libtest/lib562.c +++ b/tests/libtest/lib562.c @@ -46,7 +46,8 @@ int test(char *URL) } /* get a curl handle */ - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib566.c b/tests/libtest/lib566.c index 94a91d5dd..ecf8c5530 100644 --- a/tests/libtest/lib566.c +++ b/tests/libtest/lib566.c @@ -35,7 +35,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib567.c b/tests/libtest/lib567.c index 38e0c0b78..f9f55e3c0 100644 --- a/tests/libtest/lib567.c +++ b/tests/libtest/lib567.c @@ -37,7 +37,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib568.c b/tests/libtest/lib568.c index 9b3a07787..0cdef812b 100644 --- a/tests/libtest/lib568.c +++ b/tests/libtest/lib568.c @@ -55,7 +55,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -66,7 +67,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_URL, URL); - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -100,7 +102,8 @@ int test(char *URL) sdpf = NULL; /* Make sure we can do a normal request now */ - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -115,7 +118,8 @@ int test(char *URL) /* Now do a POST style one */ - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -144,7 +148,8 @@ int test(char *URL) custom_headers = NULL; /* Make sure we can do a normal request now */ - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } diff --git a/tests/libtest/lib569.c b/tests/libtest/lib569.c index 55282b69b..d7381d9a2 100644 --- a/tests/libtest/lib569.c +++ b/tests/libtest/lib569.c @@ -53,7 +53,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); fclose(idfile); @@ -77,7 +78,8 @@ int test(char *URL) /* Go through the various Session IDs */ for(i = 0; i < 3; i++) { - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -96,7 +98,8 @@ int test(char *URL) fprintf(idfile, "Got Session ID: [%s]\n", rtsp_session_id); rtsp_session_id = NULL; - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } diff --git a/tests/libtest/lib570.c b/tests/libtest/lib570.c index 2dc57b761..9d9b5a134 100644 --- a/tests/libtest/lib570.c +++ b/tests/libtest/lib570.c @@ -40,7 +40,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -54,7 +55,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS); - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -74,7 +76,8 @@ int test(char *URL) "RAW/RAW/UDP;unicast;client_port=3056-3057"); test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP); - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -88,7 +91,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY); - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } diff --git a/tests/libtest/lib571.c b/tests/libtest/lib571.c index 32648ad12..40a78fa84 100644 --- a/tests/libtest/lib571.c +++ b/tests/libtest/lib571.c @@ -118,7 +118,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); fclose(protofile); curl_global_cleanup(); @@ -126,7 +127,8 @@ int test(char *URL) } test_setopt(curl, CURLOPT_URL, URL); - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -147,7 +149,8 @@ int test(char *URL) goto test_cleanup; /* This PLAY starts the interleave */ - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -161,7 +164,8 @@ int test(char *URL) goto test_cleanup; /* The DESCRIBE request will try to consume data after the Content */ - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -174,7 +178,8 @@ int test(char *URL) if(res) goto test_cleanup; - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } diff --git a/tests/libtest/lib572.c b/tests/libtest/lib572.c index 3475e8060..47a9da535 100644 --- a/tests/libtest/lib572.c +++ b/tests/libtest/lib572.c @@ -55,7 +55,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -69,7 +70,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_URL, URL); /* SETUP */ - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -83,7 +85,8 @@ int test(char *URL) if(res) goto test_cleanup; - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -117,7 +120,8 @@ int test(char *URL) paramsf = NULL; /* Heartbeat GET_PARAMETERS */ - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -131,7 +135,8 @@ int test(char *URL) /* POST GET_PARAMETERS */ - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } @@ -149,7 +154,8 @@ int test(char *URL) test_setopt(curl, CURLOPT_POSTFIELDS, NULL); /* Make sure we can do a normal request now */ - if((stream_uri = suburl(URL, request++)) == NULL) { + stream_uri = suburl(URL, request++); + if(!stream_uri) { res = TEST_ERR_MAJOR_BAD; goto test_cleanup; } diff --git a/tests/libtest/lib574.c b/tests/libtest/lib574.c index 9f9222b39..a51cda05f 100644 --- a/tests/libtest/lib574.c +++ b/tests/libtest/lib574.c @@ -40,7 +40,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib578.c b/tests/libtest/lib578.c index 5e01d36e0..9603b58d7 100644 --- a/tests/libtest/lib578.c +++ b/tests/libtest/lib578.c @@ -58,7 +58,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib579.c b/tests/libtest/lib579.c index aae299ccc..61aa4f5df 100644 --- a/tests/libtest/lib579.c +++ b/tests/libtest/lib579.c @@ -97,7 +97,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib586.c b/tests/libtest/lib586.c index 9b789eec7..a4fc6feee 100644 --- a/tests/libtest/lib586.c +++ b/tests/libtest/lib586.c @@ -101,7 +101,8 @@ static void *fire(void *ptr) CURL *curl; int i=0; - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); return NULL; } @@ -148,7 +149,8 @@ int test(char *URL) /* prepare share */ printf("SHARE_INIT\n"); - if((share = curl_share_init()) == NULL) { + share = curl_share_init(); + if(!share) { fprintf(stderr, "curl_share_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -197,7 +199,8 @@ int test(char *URL) /* fetch a another one */ printf("*** run %d\n", i); - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_share_cleanup(share); curl_global_cleanup(); diff --git a/tests/libtest/lib590.c b/tests/libtest/lib590.c index 7b863cc3f..cc3afdf06 100644 --- a/tests/libtest/lib590.c +++ b/tests/libtest/lib590.c @@ -46,7 +46,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib598.c b/tests/libtest/lib598.c index b107f29d4..c27e60b14 100644 --- a/tests/libtest/lib598.c +++ b/tests/libtest/lib598.c @@ -33,7 +33,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/lib599.c b/tests/libtest/lib599.c index 1dee0b978..843fb2121 100644 --- a/tests/libtest/lib599.c +++ b/tests/libtest/lib599.c @@ -50,7 +50,8 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/libtest/libauthretry.c b/tests/libtest/libauthretry.c index 065a79d46..139dab974 100644 --- a/tests/libtest/libauthretry.c +++ b/tests/libtest/libauthretry.c @@ -101,7 +101,8 @@ int test(char *url) /* Send wrong password, then right password */ - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; @@ -120,8 +121,8 @@ int test(char *url) curl_easy_cleanup(curl); /* Send wrong password twice, then right password */ - - if((curl = curl_easy_init()) == NULL) { + curl = curl_easy_init(); + if(!curl) { fprintf(stderr, "curl_easy_init() failed\n"); curl_global_cleanup(); return TEST_ERR_MAJOR_BAD; diff --git a/tests/server/getpart.c b/tests/server/getpart.c index 1952fbbe5..25758bd4e 100644 --- a/tests/server/getpart.c +++ b/tests/server/getpart.c @@ -309,7 +309,8 @@ int getpart(char **outbuf, size_t *outlen, ptr++; end = ptr; EAT_WORD(end); - if((len.sig = end - ptr) > MAX_TAG_LEN) { + len.sig = end - ptr; + if(len.sig > MAX_TAG_LEN) { error = GPE_NO_BUFFER_SPACE; break; } @@ -370,7 +371,8 @@ int getpart(char **outbuf, size_t *outlen, /* get potential tag */ end = ptr; EAT_WORD(end); - if((len.sig = end - ptr) > MAX_TAG_LEN) { + len.sig = end - ptr; + if(len.sig > MAX_TAG_LEN) { error = GPE_NO_BUFFER_SPACE; break; } @@ -389,7 +391,8 @@ int getpart(char **outbuf, size_t *outlen, end = ptr; while(*end && ('>' != *end)) end++; - if((len.sig = end - ptr) > MAX_TAG_LEN) { + len.sig = end - ptr; + if(len.sig > MAX_TAG_LEN) { error = GPE_NO_BUFFER_SPACE; break; } diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index e759e8800..ea231da3d 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -260,36 +260,42 @@ static void install_signal_handlers(void) { #ifdef SIGHUP /* ignore SIGHUP signal */ - if((old_sighup_handler = signal(SIGHUP, SIG_IGN)) == SIG_ERR) + old_sighup_handler = signal(SIGHUP, SIG_IGN); + if(old_sighup_handler == SIG_ERR) logmsg("cannot install SIGHUP handler: %s", strerror(errno)); #endif #ifdef SIGPIPE /* ignore SIGPIPE signal */ - if((old_sigpipe_handler = signal(SIGPIPE, SIG_IGN)) == SIG_ERR) + old_sigpipe_handler = signal(SIGPIPE, SIG_IGN); + if(old_sigpipe_handler == SIG_ERR) logmsg("cannot install SIGPIPE handler: %s", strerror(errno)); #endif #ifdef SIGALRM /* ignore SIGALRM signal */ - if((old_sigalrm_handler = signal(SIGALRM, SIG_IGN)) == SIG_ERR) + old_sigalrm_handler = signal(SIGALRM, SIG_IGN); + if(old_sigalrm_handler == SIG_ERR) logmsg("cannot install SIGALRM handler: %s", strerror(errno)); #endif #ifdef SIGINT /* handle SIGINT signal with our exit_signal_handler */ - if((old_sigint_handler = signal(SIGINT, exit_signal_handler)) == SIG_ERR) + old_sigint_handler = signal(SIGINT, exit_signal_handler); + if(old_sigint_handler == SIG_ERR) logmsg("cannot install SIGINT handler: %s", strerror(errno)); else siginterrupt(SIGINT, 1); #endif #ifdef SIGTERM /* handle SIGTERM signal with our exit_signal_handler */ - if((old_sigterm_handler = signal(SIGTERM, exit_signal_handler)) == SIG_ERR) + old_sigterm_handler = signal(SIGTERM, exit_signal_handler); + if(old_sigterm_handler == SIG_ERR) logmsg("cannot install SIGTERM handler: %s", strerror(errno)); else siginterrupt(SIGTERM, 1); #endif #if defined(SIGBREAK) && defined(WIN32) /* handle SIGBREAK signal with our exit_signal_handler */ - if((old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler)) == SIG_ERR) + old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler); + if(old_sigbreak_handler == SIG_ERR) logmsg("cannot install SIGBREAK handler: %s", strerror(errno)); else siginterrupt(SIGBREAK, 1); diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index e064b6c7d..78588d3ab 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -206,36 +206,42 @@ static void install_signal_handlers(void) { #ifdef SIGHUP /* ignore SIGHUP signal */ - if((old_sighup_handler = signal(SIGHUP, SIG_IGN)) == SIG_ERR) + old_sighup_handler = signal(SIGHUP, SIG_IGN); + if(old_sighup_handler == SIG_ERR) logmsg("cannot install SIGHUP handler: %s", strerror(errno)); #endif #ifdef SIGPIPE /* ignore SIGPIPE signal */ - if((old_sigpipe_handler = signal(SIGPIPE, SIG_IGN)) == SIG_ERR) + old_sigpipe_handler = signal(SIGPIPE, SIG_IGN); + if(old_sigpipe_handler == SIG_ERR) logmsg("cannot install SIGPIPE handler: %s", strerror(errno)); #endif #ifdef SIGALRM /* ignore SIGALRM signal */ - if((old_sigalrm_handler = signal(SIGALRM, SIG_IGN)) == SIG_ERR) + old_sigalrm_handler = signal(SIGALRM, SIG_IGN); + if(old_sigalrm_handler == SIG_ERR) logmsg("cannot install SIGALRM handler: %s", strerror(errno)); #endif #ifdef SIGINT /* handle SIGINT signal with our exit_signal_handler */ - if((old_sigint_handler = signal(SIGINT, exit_signal_handler)) == SIG_ERR) + old_sigint_handler = signal(SIGINT, exit_signal_handler); + if(old_sigint_handler == SIG_ERR) logmsg("cannot install SIGINT handler: %s", strerror(errno)); else siginterrupt(SIGINT, 1); #endif #ifdef SIGTERM /* handle SIGTERM signal with our exit_signal_handler */ - if((old_sigterm_handler = signal(SIGTERM, exit_signal_handler)) == SIG_ERR) + old_sigterm_handler = signal(SIGTERM, exit_signal_handler); + if(old_sigterm_handler == SIG_ERR) logmsg("cannot install SIGTERM handler: %s", strerror(errno)); else siginterrupt(SIGTERM, 1); #endif #if defined(SIGBREAK) && defined(WIN32) /* handle SIGBREAK signal with our exit_signal_handler */ - if((old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler)) == SIG_ERR) + old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler); + if(old_sigbreak_handler == SIG_ERR) logmsg("cannot install SIGBREAK handler: %s", strerror(errno)); else siginterrupt(SIGBREAK, 1); diff --git a/tests/server/sws.c b/tests/server/sws.c index af0904e29..c4125a0a8 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -265,36 +265,42 @@ static void install_signal_handlers(void) { #ifdef SIGHUP /* ignore SIGHUP signal */ - if((old_sighup_handler = signal(SIGHUP, SIG_IGN)) == SIG_ERR) + old_sighup_handler = signal(SIGHUP, SIG_IGN); + if(old_sighup_handler == SIG_ERR) logmsg("cannot install SIGHUP handler: %s", strerror(errno)); #endif #ifdef SIGPIPE /* ignore SIGPIPE signal */ - if((old_sigpipe_handler = signal(SIGPIPE, SIG_IGN)) == SIG_ERR) + old_sigpipe_handler = signal(SIGPIPE, SIG_IGN); + if(old_sigpipe_handler == SIG_ERR) logmsg("cannot install SIGPIPE handler: %s", strerror(errno)); #endif #ifdef SIGALRM /* ignore SIGALRM signal */ - if((old_sigalrm_handler = signal(SIGALRM, SIG_IGN)) == SIG_ERR) + old_sigalrm_handler = signal(SIGALRM, SIG_IGN); + if(old_sigalrm_handler == SIG_ERR) logmsg("cannot install SIGALRM handler: %s", strerror(errno)); #endif #ifdef SIGINT /* handle SIGINT signal with our exit_signal_handler */ - if((old_sigint_handler = signal(SIGINT, exit_signal_handler)) == SIG_ERR) + old_sigint_handler = signal(SIGINT, exit_signal_handler); + if(old_sigint_handler == SIG_ERR) logmsg("cannot install SIGINT handler: %s", strerror(errno)); else siginterrupt(SIGINT, 1); #endif #ifdef SIGTERM /* handle SIGTERM signal with our exit_signal_handler */ - if((old_sigterm_handler = signal(SIGTERM, exit_signal_handler)) == SIG_ERR) + old_sigterm_handler = signal(SIGTERM, exit_signal_handler); + if(old_sigterm_handler == SIG_ERR) logmsg("cannot install SIGTERM handler: %s", strerror(errno)); else siginterrupt(SIGTERM, 1); #endif #if defined(SIGBREAK) && defined(WIN32) /* handle SIGBREAK signal with our exit_signal_handler */ - if((old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler)) == SIG_ERR) + old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler); + if(old_sigbreak_handler == SIG_ERR) logmsg("cannot install SIGBREAK handler: %s", strerror(errno)); else siginterrupt(SIGBREAK, 1); diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index 8a4ed0b19..c8667437e 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -367,31 +367,36 @@ static void install_signal_handlers(void) { #ifdef SIGHUP /* ignore SIGHUP signal */ - if((old_sighup_handler = signal(SIGHUP, SIG_IGN)) == SIG_ERR) + old_sighup_handler = signal(SIGHUP, SIG_IGN); + if(old_sighup_handler == SIG_ERR) logmsg("cannot install SIGHUP handler: %s", strerror(errno)); #endif #ifdef SIGPIPE /* ignore SIGPIPE signal */ - if((old_sigpipe_handler = signal(SIGPIPE, SIG_IGN)) == SIG_ERR) + old_sigpipe_handler = signal(SIGPIPE, SIG_IGN); + if(old_sigpipe_handler == SIG_ERR) logmsg("cannot install SIGPIPE handler: %s", strerror(errno)); #endif #ifdef SIGINT /* handle SIGINT signal with our exit_signal_handler */ - if((old_sigint_handler = signal(SIGINT, exit_signal_handler)) == SIG_ERR) + old_sigint_handler = signal(SIGINT, exit_signal_handler); + if(old_sigint_handler == SIG_ERR) logmsg("cannot install SIGINT handler: %s", strerror(errno)); else siginterrupt(SIGINT, 1); #endif #ifdef SIGTERM /* handle SIGTERM signal with our exit_signal_handler */ - if((old_sigterm_handler = signal(SIGTERM, exit_signal_handler)) == SIG_ERR) + old_sigterm_handler = signal(SIGTERM, exit_signal_handler); + if(old_sigterm_handler == SIG_ERR) logmsg("cannot install SIGTERM handler: %s", strerror(errno)); else siginterrupt(SIGTERM, 1); #endif #if defined(SIGBREAK) && defined(WIN32) /* handle SIGBREAK signal with our exit_signal_handler */ - if((old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler)) == SIG_ERR) + old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler); + if(old_sigbreak_handler == SIG_ERR) logmsg("cannot install SIGBREAK handler: %s", strerror(errno)); else siginterrupt(SIGBREAK, 1); diff --git a/tests/unit/unit1305.c b/tests/unit/unit1305.c index 9af0727c3..db0a44c5f 100644 --- a/tests/unit/unit1305.c +++ b/tests/unit/unit1305.c @@ -80,15 +80,18 @@ static Curl_addrinfo *fake_ai(void) ss_size = sizeof(struct sockaddr_in); - if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) + ai = calloc(1, sizeof(Curl_addrinfo)); + if(!ai) return NULL; - if((ai->ai_canonname = strdup("dummy")) == NULL) { + ai->ai_canonname = strdup("dummy"); + if(!ai->ai_canonname) { free(ai); return NULL; } - if((ai->ai_addr = calloc(1, ss_size)) == NULL) { + ai->ai_addr = calloc(1, ss_size); + if(!ai->ai_addr) { free(ai->ai_canonname); free(ai); return NULL; -- cgit v1.2.3