]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
socketpair: clear 'err' when retrying due to EINTR
authorDaniel Stenberg <daniel@haxx.se>
Tue, 3 Mar 2026 22:50:08 +0000 (23:50 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 6 Mar 2026 21:50:29 +0000 (22:50 +0100)
If the first write was interrupted by a signal and a subsequent write
succeeds, the function would still erroneously return EINTR.

Found by Codex Security
Closes #20809

lib/socketpair.c

index 7fd7e30bbab8271c2ff28ebd5d217375371c0d0d..76b959dd4afc698252290be068b482940a041b5e 100644 (file)
@@ -317,6 +317,7 @@ int Curl_wakeup_signal(curl_socket_t socks[2])
 #endif
 
   while(1) {
+    err = 0;
     if(wakeup_write(socks[1], buf, sizeof(buf)) < 0) {
       err = SOCKERRNO;
 #ifdef USE_WINSOCK