diff options
| author | Jason Evans <jasone@FreeBSD.org> | 1999-12-16 22:35:40 +0000 |
|---|---|---|
| committer | Jason Evans <jasone@FreeBSD.org> | 1999-12-16 22:35:40 +0000 |
| commit | e6a5e33c6b7713d446d7c29ab63b2e74ce785c86 (patch) | |
| tree | 2fb617baa8068148702da499ba2ee3a6a9dc31e0 /lib/libpthread/thread/thr_writev.c | |
| parent | 6a4152243f1b6dba4ad0952116c83b6072b23a9c (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_writev.c')
| -rw-r--r-- | lib/libpthread/thread/thr_writev.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_writev.c b/lib/libpthread/thread/thr_writev.c index 8ca5db7d8264..375f59912b6f 100644 --- a/lib/libpthread/thread/thr_writev.c +++ b/lib/libpthread/thread/thr_writev.c @@ -136,8 +136,20 @@ 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; + } + } + /* * If performing a blocking write, check if the * write would have blocked or if some bytes |
