summaryrefslogtreecommitdiffstats
path: root/source/lib/socket/socket_unix.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-28 07:55:33 +0000
committerAndrew Tridgell <tridge@samba.org>2004-10-28 07:55:33 +0000
commite1f6e35d16adbeef857b57d05b61b694fb2e9593 (patch)
treea0bf4dedc4a0178bbe92caf4d6115b128bc67fef /source/lib/socket/socket_unix.c
parent2b1a24fac0792dc8e24ccc1d19cbbba23e2a8ea6 (diff)
downloadsamba-e1f6e35d16adbeef857b57d05b61b694fb2e9593.tar.gz
samba-e1f6e35d16adbeef857b57d05b61b694fb2e9593.tar.xz
samba-e1f6e35d16adbeef857b57d05b61b694fb2e9593.zip
r3314: added a option "socket:testnonblock" to the generic socket code. If
you set this option (either on the command line using --option or in smb.conf) then every socket recv or send will return short by random amounts. This allows you to test that the non-blocking socket logic in your code works correctly. I also removed the flags argument to socket_accept(), and instead made the new socket inherit the flags of the old socket, which makes more sense to me.
Diffstat (limited to 'source/lib/socket/socket_unix.c')
-rw-r--r--source/lib/socket/socket_unix.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/source/lib/socket/socket_unix.c b/source/lib/socket/socket_unix.c
index 239e4eb0694..d160d897ee2 100644
--- a/source/lib/socket/socket_unix.c
+++ b/source/lib/socket/socket_unix.c
@@ -124,8 +124,7 @@ static NTSTATUS unixdom_listen(struct socket_context *sock,
}
static NTSTATUS unixdom_accept(struct socket_context *sock,
- struct socket_context **new_sock,
- uint32_t flags)
+ struct socket_context **new_sock)
{
struct sockaddr_un cli_addr;
socklen_t cli_addr_len = sizeof(cli_addr);
@@ -136,7 +135,7 @@ static NTSTATUS unixdom_accept(struct socket_context *sock,
return unixdom_error(errno);
}
- if (!(flags & SOCKET_FLAG_BLOCK)) {
+ if (!(sock->flags & SOCKET_FLAG_BLOCK)) {
int ret = set_blocking(new_fd, False);
if (ret == -1) {
close(new_fd);
@@ -153,7 +152,7 @@ static NTSTATUS unixdom_accept(struct socket_context *sock,
/* copy the socket_context */
(*new_sock)->type = sock->type;
(*new_sock)->state = SOCKET_STATE_SERVER_CONNECTED;
- (*new_sock)->flags = flags;
+ (*new_sock)->flags = sock->flags;
(*new_sock)->fd = new_fd;