summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorjk115741 <none@none>2005-09-12 05:19:28 -0700
committerjk115741 <none@none>2005-09-12 05:19:28 -0700
commit66ac517ef5ae556eb413e14e9546003581b9045f (patch)
tree5dec72d0ccfb5b6ea52891a807d888a2230905cf /usr
parent5114ab9e55159f74e60386eedf4934dfd140be47 (diff)
downloadillumos-gate-66ac517ef5ae556eb413e14e9546003581b9045f.tar.gz
6231877 WANBoot client hangs if http server is stopped
Diffstat (limited to 'usr')
-rw-r--r--usr/src/stand/lib/sock/socket.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr/src/stand/lib/sock/socket.c b/usr/src/stand/lib/sock/socket.c
index c89c7e1ba0..0e347cfbf8 100644
--- a/usr/src/stand/lib/sock/socket.c
+++ b/usr/src/stand/lib/sock/socket.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* socket.c, Code implementing a simple socket interface.
@@ -526,14 +526,18 @@ socket_read(int s, void *buf, size_t nbyte, int read_timeout)
* or an error occurs
*/
start = prom_gettime();
- while ((n = recvfrom(s, buf, nbyte, 0, &from, &fromlen)) == 0) {
- diff = (uint_t)((prom_gettime() - start) + 500) / 1000;
- if (read_timeout != 0 && diff > read_timeout) {
- errno = EINTR;
- return (-1);
+ for (;;) {
+ n = recvfrom(s, buf, nbyte, MSG_DONTWAIT, NULL, NULL);
+ if (n == -1 && errno == EWOULDBLOCK) {
+ diff = (uint_t)((prom_gettime() - start) + 500) / 1000;
+ if (read_timeout != 0 && diff > read_timeout) {
+ errno = EINTR;
+ return (-1);
+ }
+ } else {
+ return (n);
}
}
- return (n);
}
/*