1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

lib: Remove unused SOCKET_FLAG_BLOCK

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>
This commit is contained in:
Volker Lendecke 2020-03-20 11:31:15 +01:00 committed by Stefan Metzmacher
parent 051b7c135c
commit f52f531771
4 changed files with 33 additions and 50 deletions

View 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);
}

View 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

View 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);

View 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);