From c18aba263448274fa7196f623df4554b4fc11333 Mon Sep 17 00:00:00 2001 From: agc Date: Fri, 22 Mar 2002 11:26:04 +0000 Subject: 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. --- net/ORBit/patches/patch-an | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 net/ORBit/patches/patch-an (limited to 'net/ORBit/patches') 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 ++ ++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) + { -- cgit v1.2.3