From bb632c6651a521f757074ea1256d520ee7b719b4 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Fri, 7 Jul 2017 19:53:13 +0100 Subject: [PATCH] ss_read: silence signed vs unsigned comparison warning. --- src/dinit-util.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dinit-util.h b/src/dinit-util.h index 3b4c42c..947878e 100644 --- a/src/dinit-util.h +++ b/src/dinit-util.h @@ -5,12 +5,12 @@ // Signal-safe read. Read and re-try if interrupted by signal (EINTR). // *May* affect errno even on a successful read (when the return is less than n). -inline int ss_read(int fd, void * buf, size_t n) +inline ssize_t ss_read(int fd, void * buf, size_t n) { char * cbuf = static_cast(buf); - int r = 0; - while (r < n) { - int res = read(fd, cbuf + r, n - r); + ssize_t r = 0; + while ((size_t)r < n) { + ssize_t res = read(fd, cbuf + r, n - r); if (res == 0) { return r; } -- 2.25.1