]> granicus.if.org Git - curl/commitdiff
connect: silence sign-compare warning
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Sun, 13 Oct 2019 09:13:34 +0000 (11:13 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Sun, 13 Oct 2019 20:09:59 +0000 (22:09 +0200)
With MinGW-w64 using WinSock, `curl_socklen_t` is signed, while the
result of `sizeof` is unsigned.

Closes https://github.com/curl/curl/pull/4483

lib/connect.c

index bb2275e4da14bdc09fe14319688ada9a990bb8af..4c8c956a429b38386bb2f4f709df1a83ba35646e 100644 (file)
@@ -665,7 +665,7 @@ bool Curl_addr2string(struct sockaddr *sa, curl_socklen_t salen,
 #endif
 #if defined(HAVE_SYS_UN_H) && defined(AF_UNIX)
     case AF_UNIX:
-      if(salen > sizeof(sa_family_t)) {
+      if(salen > (curl_socklen_t)sizeof(sa_family_t)) {
         su = (struct sockaddr_un*)sa;
         msnprintf(addr, MAX_IPADR_LEN, "%s", su->sun_path);
       }