summaryrefslogtreecommitdiff
path: root/net/ORBit/patches/patch-an
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2003-01-19 13:48:18 +0000
committerwiz <wiz@pkgsrc.org>2003-01-19 13:48:18 +0000
commit5370b9765e35060a59a6d47aae0fbb2e6be6d3a4 (patch)
treedbb46a318e74cb8819c619c35f8ab8f745be0023 /net/ORBit/patches/patch-an
parent7787c58abe01796e3ee8087f53bc1fe9ce242137 (diff)
downloadpkgsrc-5370b9765e35060a59a6d47aae0fbb2e6be6d3a4.tar.gz
Replace wrap_writev with a simpler solution (old one had some problems).
Fixes endless loop problems. Report and suggestion by Greg Troxel gdt at ir bbn com in private mail; some comments by Alistair Crooks; patch reviewed and okayed by Jaromir Dolecek. Bump PKGREVISION to 3.
Diffstat (limited to 'net/ORBit/patches/patch-an')
-rw-r--r--net/ORBit/patches/patch-an48
1 files changed, 9 insertions, 39 deletions
diff --git a/net/ORBit/patches/patch-an b/net/ORBit/patches/patch-an
index 4ed426c648a..430ae1381e9 100644
--- a/net/ORBit/patches/patch-an
+++ b/net/ORBit/patches/patch-an
@@ -1,43 +1,13 @@
-$NetBSD: patch-an,v 1.2 2002/04/25 12:17:05 agc Exp $
-Also handle EINVAL error to writev(2).
+$NetBSD: patch-an,v 1.3 2003/01/19 13:48:19 wiz Exp $
--- src/IIOP/giop-msg-buffer.c.orig Mon Mar 11 13:40:02 2002
+++ src/IIOP/giop-msg-buffer.c
-@@ -165,6 +165,37 @@
- return msgbuf;
- }
+@@ -210,7 +210,7 @@ giop_send_buffer_write(GIOPSendBuffer *s
+ res = writev (fd, curvec, MIN (nvecs, MAX_LIMITED_IOVECS));
+ /* fprintf (stderr, "wrote %ld bytes [%d]\n", res, (int) errno); */
+ #else
+- res = writev (fd, curvec, nvecs);
++ res = writev (fd, curvec, MIN(nvecs, IOV_MAX));
+ #endif
+ } while (res < 0 && errno == EINTR);
-+#ifdef __NetBSD__
-+/* NetBSD returns EINVAL if we try to send > IOV_MAX iovecs */
-+/* wrap writev so that we only ever try to send IOV_MAX at most */
-+
-+#include <limits.h>
-+
-+static int
-+wrap_writev(int fd, const struct iovec *vector, size_t count)
-+{
-+ size_t n;
-+ int ret;
-+ int wc;
-+
-+ ret = 0;
-+ while (count > 0) {
-+ n = MIN(IOV_MAX, count);
-+ if ((wc = writev(fd, vector, n)) < 0) {
-+ break;
-+ }
-+ ret += wc;
-+ vector += n;
-+ count -= n;
-+ }
-+ return ret;
-+}
-+
-+#define writev wrap_writev
-+
-+#endif /* __NetBSD__ */
-+
-+
- gint
- giop_send_buffer_write(GIOPSendBuffer *send_buffer)
- {