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>
fd1 = fds[0];
fd2 = fds[1];
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) {
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;
}
rc = _tstream_npa_existing_socket(mem_ctx2,
}
rc = _tstream_npa_existing_socket(mem_ctx2,
*pstream2 = stream2;
return 0;
*pstream2 = stream2;
return 0;
+
+close_fail:
+ {
+ int sys_errno = errno;
+ close(fd1);
+ close(fd2);
+ errno = sys_errno;
+ return -1;
+ }