]> granicus.if.org Git - curl/commitdiff
transfer: fix LGTM alert "Comparison is always true"
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Fri, 5 Apr 2019 07:14:28 +0000 (09:14 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Fri, 5 Apr 2019 10:56:10 +0000 (12:56 +0200)
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

lib/transfer.c

index ca6031724b4c0078fd86ee482f097c2f45e7263e..0c6056a08b5d42e13b59a4ef5a6d87665f8716d4 100644 (file)
@@ -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"));