diff options
| -rwxr-xr-x | configure | 4 | ||||
| -rw-r--r-- | src/libunixonacid/buffer_timed_putv.c | 7 |
2 files changed, 5 insertions, 6 deletions
@@ -57,14 +57,12 @@ EOF # If your system does not have printf, you can comment this, but it is # generally not a good idea to use echo. -# See http://etalabs.net/sh_tricks.html +# See http://www.etalabs.net/sh_tricks.html echo () { - IFS=' ' printf %s\\n "$*" } echon () { - IFS=' ' printf %s "$*" } diff --git a/src/libunixonacid/buffer_timed_putv.c b/src/libunixonacid/buffer_timed_putv.c index 0dfd56a..44e8841 100644 --- a/src/libunixonacid/buffer_timed_putv.c +++ b/src/libunixonacid/buffer_timed_putv.c @@ -9,14 +9,15 @@ size_t buffer_timed_putv (buffer *b, struct iovec const *v, unsigned int vlen, tain const *deadline, tain *stamp) { if (!vlen) return 0 ; - size_t tot = siovec_len(v, vlen), w = 0 ; + size_t tot = siovec_len(v, vlen) ; + size_t w = 0 ; struct iovec vv[vlen] ; for (unsigned int i = 0 ; i < vlen ; i++) vv[i] = v[i] ; - while (w < tot) + for (;;) { size_t r = buffer_putvnoflush(b, vv, vlen) ; w += r ; siovec_seek(vv, vlen, r) ; - if (!buffer_timed_flush(b, deadline, stamp)) break ; + if (w >= tot || !buffer_timed_flush(b, deadline, stamp)) break ; } return w ; } |
