From: Viktor Szakats Date: Wed, 11 Oct 2023 04:02:45 +0000 (+0000) Subject: lib: fix gcc warning in printf call X-Git-Tag: curl-8_5_0~253 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e57d0f0cb3907a6b65968200292d92c5305a7a6;p=thirdparty%2Fcurl.git lib: fix gcc warning in printf call Do not pass NULL to printf %s. Seen with gcc 13.2.0 on Debian: ``` .../curl/lib/connect.c:696:27: warning: '%s' directive argument is null [-Wformat-overflow=] ``` Ref: https://github.com/curl/curl-for-win/actions/runs/6476161689/job/17584426483#step:3:11104 Ref: #10284 Co-authored-by: Jay Satiro Closes #12082 --- diff --git a/lib/connect.c b/lib/connect.c index c7ba3e20e3..92eebf0d28 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -693,11 +693,11 @@ evaluate: result = CURLE_COULDNT_CONNECT; for(i = 0; i < sizeof(ctx->baller)/sizeof(ctx->baller[0]); i++) { struct eyeballer *baller = ctx->baller[i]; + if(!baller) + continue; CURL_TRC_CF(data, cf, "%s assess started=%d, result=%d", - baller?baller->name:NULL, - baller?baller->has_started:0, - baller?baller->result:0); - if(baller && baller->has_started && baller->result) { + baller->name, baller->has_started, baller->result); + if(baller->has_started && baller->result) { result = baller->result; break; }