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);
}
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);
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 unixdom_error(errno);
- }
+ ret = set_blocking(sock->fd, false);
+ if (ret == -1) {
+ return unixdom_error(errno);
}
sock->state = SOCKET_STATE_SERVER_LISTEN;
{
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;
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);