]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cf-socket: if FD_CLOEXEC fails on accepted socket, cleanup
authorDaniel Stenberg <daniel@haxx.se>
Fri, 17 Oct 2025 11:23:46 +0000 (13:23 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 17 Oct 2025 14:12:34 +0000 (16:12 +0200)
Follow-up to 9d7b532404181568de1611084bd9f

Pointed out by ZeroPath

Closes #19098

lib/cf-socket.c

index 758641e40dbe3c889bdaab9bdec3c9cb8405ac10..40df786bafa42b90365c778fc331c1b8d942beb7 100644 (file)
@@ -2138,6 +2138,7 @@ static CURLcode cf_tcp_accept_connect(struct Curl_cfilter *cf,
      (curlx_nonblock(s_accepted, TRUE) < 0)) {
     failf(data, "fcntl set CLOEXEC/NONBLOCK: %s",
           curlx_strerror(SOCKERRNO, errbuf, sizeof(errbuf)));
+    Curl_socket_close(data, cf->conn, s_accepted);
     return CURLE_FTP_ACCEPT_FAILED;
   }
 #endif