From: Marcel Raad Date: Fri, 5 Apr 2019 07:14:28 +0000 (+0200) Subject: transfer: fix LGTM alert "Comparison is always true" X-Git-Tag: curl-7_65_0~200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1369b7429958a22a76754a28bc6c6743c62fa23d;p=curl transfer: fix LGTM alert "Comparison is always true" Just remove the redundant condition, which also makes it clear that k->buf is always 0-terminated if this break is not hit. Closes https://github.com/curl/curl/pull/3732 --- diff --git a/lib/transfer.c b/lib/transfer.c index ca6031724..0c6056a08 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -650,7 +650,7 @@ static CURLcode readwrite_data(struct Curl_easy *data, if(0 < nread || is_empty_data) { k->buf[nread] = 0; } - else if(0 >= nread) { + else { /* if we receive 0 or less here, the server closed the connection and we bail out from this! */ DEBUGF(infof(data, "nread <= 0, server closed connection, bailing\n"));