aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2025-03-25 06:48:24 +0000
committerLaurent Bercot <ska@appnovation.com>2025-03-25 06:48:24 +0000
commit56ab53289c60c6fbb06f8d548d353535d5ed1140 (patch)
tree263a7ee6cf762b2a02a4a64533a54454b3f6d076
parent5d615a6f7208665ebb79390b4834c6a40a0d6f66 (diff)
downloadskalibs-56ab53289c60c6fbb06f8d548d353535d5ed1140.tar.gz
Don't autoflush buffer_timed_putv; fix IFS bug in configure
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rwxr-xr-xconfigure4
-rw-r--r--src/libunixonacid/buffer_timed_putv.c7
2 files changed, 5 insertions, 6 deletions
diff --git a/configure b/configure
index 364ae60..e971be8 100755
--- a/configure
+++ b/configure
@@ -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 ;
}