lib: Remove unused SOCKET_FLAG_BLOCK
authorVolker Lendecke <vl@samba.org>
Fri, 20 Mar 2020 10:31:15 +0000 (11:31 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 25 Mar 2020 09:04:28 +0000 (09:04 +0000)
Nobody in the code set this flag, so remove it

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/lib/socket/socket.c
source4/lib/socket/socket.h
source4/lib/socket/socket_ip.c
source4/lib/socket/socket_unix.c

index d7535bf357a5c427f8fae6072d4a7d3468197116..26f23f5665366a43e01df889146c3239ccd89e9d 100644 (file)
@@ -79,15 +79,14 @@ _PUBLIC_ NTSTATUS socket_create_with_ops(TALLOC_CTX *mem_ctx, const struct socke
           send calls on non-blocking sockets will randomly recv/send
           less data than requested */
 
-       if (!(flags & SOCKET_FLAG_BLOCK) &&
-           type == SOCKET_TYPE_STREAM &&
+       if (type == SOCKET_TYPE_STREAM &&
                getenv("SOCKET_TESTNONBLOCK") != NULL) {
                (*new_sock)->flags |= SOCKET_FLAG_TESTNONBLOCK;
        }
 
        /* we don't do a connect() on dgram sockets, so need to set
           non-blocking at socket create time */
-       if (!(flags & SOCKET_FLAG_BLOCK) && type == SOCKET_TYPE_DGRAM) {
+       if (type == SOCKET_TYPE_DGRAM) {
                set_blocking(socket_get_fd(*new_sock), false);
        }
 
index a492bc1036752180b9250409e21e0810bae1154e..d0fb5e0bfca0cdb17af6ac16d7a15711907cf491 100644 (file)
@@ -98,7 +98,6 @@ enum socket_state {
        SOCKET_STATE_SERVER_ERROR
 };
 
-#define SOCKET_FLAG_BLOCK        0x00000001
 #define SOCKET_FLAG_PEEK         0x00000002
 #define SOCKET_FLAG_TESTNONBLOCK 0x00000004
 #define SOCKET_FLAG_ENCRYPT      0x00000008 /* This socket
index 2aba491e06cc1a4cf62a3aaad76126a480745da2..762ec3d48c4789e3cf9a022496b17698a22b4317 100644 (file)
@@ -81,11 +81,9 @@ static NTSTATUS ip_connect_complete(struct socket_context *sock, uint32_t flags)
                return map_nt_error_from_unix_common(error);
        }
 
-       if (!(flags & SOCKET_FLAG_BLOCK)) {
-               ret = set_blocking(sock->fd, false);
-               if (ret == -1) {
-                       return map_nt_error_from_unix_common(errno);
-               }
+       ret = set_blocking(sock->fd, false);
+       if (ret == -1) {
+               return map_nt_error_from_unix_common(errno);
        }
 
        sock->state = SOCKET_STATE_CLIENT_CONNECTED;
@@ -201,11 +199,9 @@ static NTSTATUS ipv4_listen(struct socket_context *sock,
                }
        }
 
-       if (!(flags & SOCKET_FLAG_BLOCK)) {
-               ret = set_blocking(sock->fd, false);
-               if (ret == -1) {
-                       return map_nt_error_from_unix_common(errno);
-               }
+       ret = set_blocking(sock->fd, false);
+       if (ret == -1) {
+               return map_nt_error_from_unix_common(errno);
        }
 
        sock->state= SOCKET_STATE_SERVER_LISTEN;
@@ -217,7 +213,7 @@ static NTSTATUS ipv4_accept(struct socket_context *sock, struct socket_context *
 {
        struct sockaddr_in cli_addr;
        socklen_t cli_addr_len = sizeof(cli_addr);
-       int new_fd;
+       int new_fd, ret;
 
        if (sock->type != SOCKET_TYPE_STREAM) {
                return NT_STATUS_INVALID_PARAMETER;
@@ -228,13 +224,12 @@ static NTSTATUS ipv4_accept(struct socket_context *sock, struct socket_context *
                return map_nt_error_from_unix_common(errno);
        }
 
-       if (!(sock->flags & SOCKET_FLAG_BLOCK)) {
-               int ret = set_blocking(new_fd, false);
-               if (ret == -1) {
-                       close(new_fd);
-                       return map_nt_error_from_unix_common(errno);
-               }
+       ret = set_blocking(new_fd, false);
+       if (ret == -1) {
+               close(new_fd);
+               return map_nt_error_from_unix_common(errno);
        }
+
        smb_set_close_on_exec(new_fd);
 
 
@@ -731,11 +726,9 @@ static NTSTATUS ipv6_listen(struct socket_context *sock,
                }
        }
 
-       if (!(flags & SOCKET_FLAG_BLOCK)) {
-               ret = set_blocking(sock->fd, false);
-               if (ret == -1) {
-                       return map_nt_error_from_unix_common(errno);
-               }
+       ret = set_blocking(sock->fd, false);
+       if (ret == -1) {
+               return map_nt_error_from_unix_common(errno);
        }
 
        sock->state= SOCKET_STATE_SERVER_LISTEN;
@@ -747,7 +740,7 @@ static NTSTATUS ipv6_tcp_accept(struct socket_context *sock, struct socket_conte
 {
        struct sockaddr_in6 cli_addr;
        socklen_t cli_addr_len = sizeof(cli_addr);
-       int new_fd;
+       int new_fd, ret;
        
        if (sock->type != SOCKET_TYPE_STREAM) {
                return NT_STATUS_INVALID_PARAMETER;
@@ -758,12 +751,10 @@ static NTSTATUS ipv6_tcp_accept(struct socket_context *sock, struct socket_conte
                return map_nt_error_from_unix_common(errno);
        }
 
-       if (!(sock->flags & SOCKET_FLAG_BLOCK)) {
-               int ret = set_blocking(new_fd, false);
-               if (ret == -1) {
-                       close(new_fd);
-                       return map_nt_error_from_unix_common(errno);
-               }
+       ret = set_blocking(new_fd, false);
+       if (ret == -1) {
+               close(new_fd);
+               return map_nt_error_from_unix_common(errno);
        }
        smb_set_close_on_exec(new_fd);
 
index 6876e395ed632d1e706b865b33449b45460899e1..d4946d88eebd205f9c7fa33b69ed01e99e92709f 100644 (file)
@@ -84,11 +84,9 @@ static NTSTATUS unixdom_connect_complete(struct socket_context *sock, uint32_t f
                return map_nt_error_from_unix_common(error);
        }
 
-       if (!(flags & SOCKET_FLAG_BLOCK)) {
-               ret = set_blocking(sock->fd, false);
-               if (ret == -1) {
-                       return map_nt_error_from_unix_common(errno);
-               }
+       ret = set_blocking(sock->fd, false);
+       if (ret == -1) {
+               return map_nt_error_from_unix_common(errno);
        }
 
        sock->state = SOCKET_STATE_CLIENT_CONNECTED;
@@ -163,11 +161,9 @@ static NTSTATUS unixdom_listen(struct socket_context *sock,
                }
        }
 
-       if (!(flags & SOCKET_FLAG_BLOCK)) {
-               ret = set_blocking(sock->fd, false);
-               if (ret == -1) {
-                       return unixdom_error(errno);
-               }
+       ret = set_blocking(sock->fd, false);
+       if (ret == -1) {
+               return unixdom_error(errno);
        }
 
        sock->state = SOCKET_STATE_SERVER_LISTEN;
@@ -181,7 +177,7 @@ static NTSTATUS unixdom_accept(struct socket_context *sock,
 {
        struct sockaddr_un cli_addr;
        socklen_t cli_addr_len = sizeof(cli_addr);
-       int new_fd;
+       int new_fd, ret;
 
        if (sock->type != SOCKET_TYPE_STREAM) {
                return NT_STATUS_INVALID_PARAMETER;
@@ -192,12 +188,10 @@ static NTSTATUS unixdom_accept(struct socket_context *sock,
                return unixdom_error(errno);
        }
 
-       if (!(sock->flags & SOCKET_FLAG_BLOCK)) {
-               int ret = set_blocking(new_fd, false);
-               if (ret == -1) {
-                       close(new_fd);
-                       return map_nt_error_from_unix_common(errno);
-               }
+       ret = set_blocking(new_fd, false);
+       if (ret == -1) {
+               close(new_fd);
+               return map_nt_error_from_unix_common(errno);
        }
 
        smb_set_close_on_exec(new_fd);