From 493a37ba663686b7bee3f7093d6650a24250f101 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 23 Apr 2004 04:21:22 +0000 Subject: r335: added much better handling of servers that die unexpectedly during a request (a dead socket). I discovered this when testing against Sun's PC-NetLink. cleaned up the naming of some of the samr requests add IDL and test code for samr_QueryGroupMember(), samr_SetMemberAttributesOfGroup() and samr_Shutdown(). (actually, I didn't leave the samr_Shutdown() test in, as its fatal to windows servers due to doing exactly what it says it does). (This used to be commit 925bc2622c105dee4ffff809c6c35cd209a839f8) --- source4/lib/util_sock.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source4/lib/util_sock.c') diff --git a/source4/lib/util_sock.c b/source4/lib/util_sock.c index 95e0c5fe0c..57d3715cfc 100644 --- a/source4/lib/util_sock.c +++ b/source4/lib/util_sock.c @@ -187,6 +187,11 @@ ssize_t read_data(int fd, char *buffer, size_t N) ssize_t ret; size_t total=0; + if (fd == -1) { + errno = EIO; + return -1; + } + while (total < N) { ret = sys_read(fd,buffer + total,N - total); if (ret == 0) { @@ -209,6 +214,11 @@ ssize_t write_data(int fd, const char *buffer, size_t N) size_t total=0; ssize_t ret; + if (fd == -1) { + errno = EIO; + return -1; + } + while (total < N) { ret = sys_write(fd, buffer + total, N - total); if (ret == -1) { -- cgit