diff options
Diffstat (limited to 'lib/libc_r')
-rw-r--r-- | lib/libc_r/uthread/uthread_writev.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_writev.c b/lib/libc_r/uthread/uthread_writev.c index 411b3bc0238..be26356d2c9 100644 --- a/lib/libc_r/uthread/uthread_writev.c +++ b/lib/libc_r/uthread/uthread_writev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_writev.c,v 1.3 1999/11/25 07:01:47 d Exp $ */ +/* $OpenBSD: uthread_writev.c,v 1.4 2001/08/11 14:56:07 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -137,6 +137,18 @@ writev(int fd, const struct iovec * iov, int iovcnt) cnt = 0; } } + } else if (n == 0) { + /* + * Avoid an infinite loop if the last iov_len is + * 0. + */ + while (idx < iovcnt && p_iov[idx].iov_len == 0) + idx++; + + if (idx == iovcnt) { + ret = num; + break; + } } /* |