]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ftp: convert 'sock_accepted' to a plain boolean
authorDaniel Stenberg <daniel@haxx.se>
Fri, 14 Feb 2020 23:00:45 +0000 (00:00 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 16 Feb 2020 21:23:17 +0000 (22:23 +0100)
This was an array indexed with sockindex but it was only ever used for
the secondary socket.

Closes #4929

lib/connect.c
lib/ftp.c
lib/urldata.h

index 611d6d2f0263eefdd2217a286ec3e4bf7ed2d3bc..9baadb565b3fba975329f25358413c6672d417ff 100644 (file)
@@ -1428,12 +1428,11 @@ int Curl_closesocket(struct connectdata *conn,
                       curl_socket_t sock)
 {
   if(conn && conn->fclosesocket) {
-    if((sock == conn->sock[SECONDARYSOCKET]) &&
-       conn->sock_accepted[SECONDARYSOCKET])
+    if((sock == conn->sock[SECONDARYSOCKET]) && conn->sock_accepted)
       /* if this socket matches the second socket, and that was created with
          accept, then we MUST NOT call the callback but clear the accepted
          status */
-      conn->sock_accepted[SECONDARYSOCKET] = FALSE;
+      conn->sock_accepted = FALSE;
     else {
       int rc;
       Curl_multi_closed(conn->data, sock);
index c3efdc4e9501a898a5355581f088a5e0164c29e4..537fd82d1eb5d5bdddcc64e270c06d4457fffec8 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -291,7 +291,7 @@ static CURLcode AcceptServerConnect(struct connectdata *conn)
 
   conn->sock[SECONDARYSOCKET] = s;
   (void)curlx_nonblock(s, TRUE); /* enable non-blocking */
-  conn->sock_accepted[SECONDARYSOCKET] = TRUE;
+  conn->sock_accepted = TRUE;
 
   if(data->set.fsockopt) {
     int error = 0;
index e2afc6406029b0241e8fd65d5fb6397e60bbe019..e1c3e181b7bf04c4c761b8b8639c5cbb3370c57a 100644 (file)
@@ -925,8 +925,6 @@ struct connectdata {
   curl_socket_t sock[2]; /* two sockets, the second is used for the data
                             transfer when doing FTP */
   curl_socket_t tempsock[2]; /* temporary sockets for happy eyeballs */
-  bool sock_accepted[2]; /* TRUE if the socket on this index was created with
-                            accept() */
   Curl_recv *recv[2];
   Curl_send *send[2];
 
@@ -1081,6 +1079,8 @@ struct connectdata {
                               handle */
   BIT(writechannel_inuse); /* whether the write channel is in use by an easy
                               handle */
+  BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with
+                         accept() */
 };
 
 /* The end of connectdata. */