From: Daniel Stenberg Date: Sat, 8 Feb 2025 21:47:50 +0000 (+0100) Subject: libssh2: comparison is always true because rc <= -1 X-Git-Tag: curl-8_12_1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54cd27a50da79fc6608abf2ab0dad15e52818430;p=thirdparty%2Fcurl.git libssh2: comparison is always true because rc <= -1 Pointed out by CodeQL Closes #16268 --- diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index 1707e6d5d9..4a67edc514 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -1633,10 +1633,10 @@ static CURLcode sftp_readdir(struct Curl_easy *data, return result; } } - else if(rc == 0) { + else if(!rc) { state(data, SSH_SFTP_READDIR_DONE); } - else if(rc < 0) { + else { unsigned long sftperr = libssh2_sftp_last_error(sshc->sftp_session); result = sftp_libssh2_error_to_CURLE(sftperr); sshc->actualcode = result ? result : CURLE_SSH;