From 58cdddb0a09e74fe6447c99a34dfa2ce7f8b5dee Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 2 Apr 2025 16:58:27 +0000 Subject: Make answer content-length uint64-clean Signed-off-by: Laurent Bercot --- src/tipideed/stream.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/tipideed/stream.c') diff --git a/src/tipideed/stream.c b/src/tipideed/stream.c index 04faf21..a0bdbd2 100644 --- a/src/tipideed/stream.c +++ b/src/tipideed/stream.c @@ -10,7 +10,9 @@ #include #include #include +#include +#include #include #include #include @@ -22,7 +24,7 @@ struct fixed_info_s { int fd ; - size_t n ; + uint64_t n ; } ; static int fixed_getfd (void *b) @@ -36,7 +38,7 @@ static ssize_t fixed_get (void *b) struct fixed_info_s *si = b ; while (si->n) { - ssize_t r = sanitize_read(splice(si->fd, 0, 1, 0, si->n, SPLICE_F_NONBLOCK)) ; + ssize_t r = sanitize_read(splice(si->fd, 0, 1, 0, si->n > SSIZE_MAX ? SSIZE_MAX : si->n, SPLICE_F_NONBLOCK)) ; if (r == -1) break ; if (!r) return 0 ; si->n -= r ; @@ -44,7 +46,7 @@ static ssize_t fixed_get (void *b) return si->n ? -1 : 1 ; } -void stream_fixed (int fd, size_t n, char const *fn) +void stream_fixed (int fd, uint64_t n, char const *fn) { tain deadline ; struct fixed_info_s si = { .fd = fd, .n = n } ; @@ -87,7 +89,7 @@ void stream_infinite (int fd, char const *fn) #include "tipideed-internal.h" -void stream_fixed (int fd, size_t n, char const *fn) +void stream_fixed (int fd, uint64_t n, char const *fn) { tain deadline ; struct iovec v[2] ; -- cgit v1.3.1