summaryrefslogtreecommitdiff
path: root/net/ORBit
diff options
context:
space:
mode:
authoragc <agc>2002-03-22 11:26:04 +0000
committeragc <agc>2002-03-22 11:26:04 +0000
commitc18aba263448274fa7196f623df4554b4fc11333 (patch)
treedb2c3170a98a57fae98ea234380b7fe1fc649021 /net/ORBit
parent74c1fb85337cc648abb9847ae9effe8954f9161c (diff)
downloadpkgsrc-c18aba263448274fa7196f623df4554b4fc11333.tar.gz
The ORBit code doesn't check the number of iovec structs before it
calls writev(2). Some of the applications which use ORBit, such as oaf, can send 1214 iovecs, which is slightly more than IOV_MAX. Add a wrapper for writev(2), to check the number of iovecs passed to writev, and loop, sending MIN(IOV_MAX, count) until the iovecs have all been written.
Diffstat (limited to 'net/ORBit')
-rw-r--r--net/ORBit/distinfo3
-rw-r--r--net/ORBit/patches/patch-an44
2 files changed, 46 insertions, 1 deletions
diff --git a/net/ORBit/distinfo b/net/ORBit/distinfo
index 4cc83a68e2b..26147a505ff 100644
--- a/net/ORBit/distinfo
+++ b/net/ORBit/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.7 2002/01/15 23:52:11 rh Exp $
+$NetBSD: distinfo,v 1.8 2002/03/22 11:26:04 agc Exp $
SHA1 (ORBit-0.5.13.tar.gz) = ea8d790b040356e90fd81aa98313c2c1b08f3bcf
Size (ORBit-0.5.13.tar.gz) = 1183657 bytes
@@ -13,3 +13,4 @@ SHA1 (patch-ai) = a5ec30692a14fb6bef617f262b6bb1fdd8903436
SHA1 (patch-ak) = d569014320dbea40ccdb9e369e07c984ee7bd9de
SHA1 (patch-al) = 0bba5ec17f8b663f1ca9427538bac238411321a0
SHA1 (patch-am) = c959b34edc150c1d503d2bb294f072e885daed58
+SHA1 (patch-an) = 1ddda1443d527d54f8b4b2ffab500a746e82b0d1
diff --git a/net/ORBit/patches/patch-an b/net/ORBit/patches/patch-an
new file mode 100644
index 00000000000..b930909c4d0
--- /dev/null
+++ b/net/ORBit/patches/patch-an
@@ -0,0 +1,44 @@
+$NetBSD: patch-an,v 1.1 2002/03/22 11:26:05 agc Exp $
+
+Also handle EINVAL error to writev(2)
+
+--- src/IIOP/giop-msg-buffer.c 2002/03/22 10:43:32 1.1
++++ src/IIOP/giop-msg-buffer.c 2002/03/22 10:44:27
+@@ -169,6 +169,37 @@
+ return msgbuf;
+ }
+
++#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)
+ {