]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests/server: replace `errno` with `SOCKERRNO` in sockfilt, socksd, sws
authorViktor Szakats <commit@vsz.me>
Tue, 4 Mar 2025 14:32:18 +0000 (15:32 +0100)
committerViktor Szakats <commit@vsz.me>
Tue, 4 Mar 2025 17:23:40 +0000 (18:23 +0100)
To correctly read the winsock2 result code on Windows.

Follow-up to de2126b1821fecbc1f66715714cb34c5c2d14ec4 #5241
Ref: https://github.com/curl/curl/commit/5e855bbd18f84a02c951be7cac6188276818cdac#r38507132
Ref: #14854
Closes #16553

tests/server/sockfilt.c
tests/server/socksd.c
tests/server/sws.c

index 04ec469fb7a96b8d2e1a85a74b6a91a14ba21f2f..9c346206d19056cf10ca3de0a8124553d5b92ce7 100644 (file)
@@ -1081,11 +1081,11 @@ static bool juggle(curl_socket_t *sockfdp,
       return FALSE;
     }
 
-  } while((rc == -1) && ((error = errno) == EINTR));
+  } while((rc == -1) && ((error = SOCKERRNO) == EINTR));
 
   if(rc < 0) {
     logmsg("select() failed with error: (%d) %s",
-           error, strerror(error));
+           error, sstrerror(error));
     return FALSE;
   }
 
index e98071ea735353157bac73f8546a4d6f11be79cd..83e86074689c3819016286565d99a9f78c1b19a3 100644 (file)
@@ -740,7 +740,7 @@ static bool incoming(curl_socket_t listenfd)
         logmsg("signalled to die, exiting...");
         return FALSE;
       }
-    } while((rc == -1) && ((error = errno) == EINTR));
+    } while((rc == -1) && ((error = SOCKERRNO) == EINTR));
 
     if(rc < 0) {
       logmsg("select() failed with error: (%d) %s",
index fc40d3eac9a9ddb50fc5c1fa2c1730e7e061c92c..3d1e60cfaa5e21c3e21c36e98276a3130bde2614 100644 (file)
@@ -869,7 +869,8 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
           logmsg("Got %zu bytes from client", got);
         }
 
-        if((got == -1) && ((EAGAIN == errno) || (EWOULDBLOCK == errno))) {
+        if((got == -1) && ((SOCKERRNO == EAGAIN) ||
+                           (SOCKERRNO == EWOULDBLOCK))) {
           int rc;
           fd_set input;
           fd_set output;
@@ -891,7 +892,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
           do {
             logmsg("Wait until readable");
             rc = select((int)sock + 1, &input, &output, NULL, &timeout);
-          } while(rc < 0 && errno == EINTR && !got_exit_signal);
+          } while(rc < 0 && SOCKERRNO == EINTR && !got_exit_signal);
           logmsg("readable %d", rc);
           if(rc)
             got = 1;
@@ -1567,7 +1568,7 @@ static void http_connect(curl_socket_t *infdp,
 
     do {
       rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
-    } while(rc < 0 && errno == EINTR && !got_exit_signal);
+    } while(rc < 0 && SOCKERRNO == EINTR && !got_exit_signal);
 
     if(got_exit_signal)
       break;
@@ -2387,7 +2388,7 @@ int main(int argc, char *argv[])
 
     do {
       rc = select((int)maxfd + 1, &input, &output, NULL, &timeout);
-    } while(rc < 0 && errno == EINTR && !got_exit_signal);
+    } while(rc < 0 && SOCKERRNO == EINTR && !got_exit_signal);
 
     if(got_exit_signal)
       goto sws_cleanup;