From: Davin McCall Date: Fri, 7 Jul 2017 18:53:13 +0000 (+0100) Subject: ss_read: silence signed vs unsigned comparison warning. X-Git-Tag: v0.06~17 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=bb632c6651a521f757074ea1256d520ee7b719b4;p=oweals%2Fdinit.git ss_read: silence signed vs unsigned comparison warning. --- 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; }