#include "system/network.h"
#include "lib/util/util_net.h"
+#undef strcasecmp
+
_PUBLIC_ const struct socket_ops *socket_ipv4_ops(enum socket_type type);
_PUBLIC_ const struct socket_ops *socket_ipv6_ops(enum socket_type type);
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;
}
}
- 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;
{
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;
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);
}
}
- 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;
{
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;
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);