diff options
author | agc <agc> | 2002-03-22 11:26:04 +0000 |
---|---|---|
committer | agc <agc> | 2002-03-22 11:26:04 +0000 |
commit | c18aba263448274fa7196f623df4554b4fc11333 (patch) | |
tree | db2c3170a98a57fae98ea234380b7fe1fc649021 /net/ORBit/patches | |
parent | 74c1fb85337cc648abb9847ae9effe8954f9161c (diff) | |
download | pkgsrc-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/patches')
-rw-r--r-- | net/ORBit/patches/patch-an | 44 |
1 files changed, 44 insertions, 0 deletions
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) + { |