summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2015-06-03 13:41:24 +0000
committerKarolin Seeger <kseeger@samba.org>2015-06-07 02:29:10 +0200
commit09e073429c04c32939856e11481a56b4326f8ffc (patch)
treecd4d59997ba4a2807c3ee80ab343e29563d50ccf /libcli
parent3f01e7513e190b0b7eee2d1f5d23d459dbafdb9b (diff)
downloadsamba-09e073429c04c32939856e11481a56b4326f8ffc.tar.gz
tstream: Make socketpair nonblocking
When we have a large RPC reply, we can't block in the RPC server. Test: Do rpcclient netshareenumall with a thousand shares defined Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Bug: https://bugzilla.samba.org/show_bug.cgi?id=11312 Autobuild-User(v4-2-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-2-test): Sun Jun 7 02:29:10 CEST 2015 on sn-devel-104
Diffstat (limited to 'libcli')
-rw-r--r--libcli/named_pipe_auth/npa_tstream.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/libcli/named_pipe_auth/npa_tstream.c b/libcli/named_pipe_auth/npa_tstream.c
index 3d3f55edd35..35392021275 100644
--- a/libcli/named_pipe_auth/npa_tstream.c
+++ b/libcli/named_pipe_auth/npa_tstream.c
@@ -1468,17 +1468,23 @@ int _tstream_npa_socketpair(uint16_t file_type,
fd1 = fds[0];
fd2 = fds[1];
+ rc = set_blocking(fd1, false);
+ if (rc == -1) {
+ goto close_fail;
+ }
+
+ rc = set_blocking(fd2, false);
+ if (rc == -1) {
+ goto close_fail;
+ }
+
rc = _tstream_npa_existing_socket(mem_ctx1,
fd1,
file_type,
&stream1,
location);
if (rc == -1) {
- int sys_errno = errno;
- close(fd1);
- close(fd2);
- errno = sys_errno;
- return -1;
+ goto close_fail;
}
rc = _tstream_npa_existing_socket(mem_ctx2,
@@ -1498,4 +1504,13 @@ int _tstream_npa_socketpair(uint16_t file_type,
*pstream2 = stream2;
return 0;
+
+close_fail:
+ {
+ int sys_errno = errno;
+ close(fd1);
+ close(fd2);
+ errno = sys_errno;
+ return -1;
+ }
}