]> www.infradead.org Git - mtd-utils.git/commitdiff
ubiformat.c: fix printf(%d, size_t) warning
authorMike Frysinger <vapier@gentoo.org>
Tue, 9 Dec 2008 13:28:03 +0000 (08:28 -0500)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Tue, 9 Dec 2008 15:08:02 +0000 (17:08 +0200)
A size_t should be printed using %zu (unsigned size_t) rather than %d.  This
fixes the following warning on my system:
gcc -O2 -Werror -Wall -Iinclude -Isrc -I../../include src/ubiformat.c -c -o ubiformat.o
cc1: warnings being treated as errors
src/ubiformat.c: In function ‘read_all’:
src/ubiformat.c:345: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
src/ubiformat.c:352: error: format ‘%d’ expects type ‘int’, but argument 3 has type ‘size_t’
make: *** [ubiformat.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
ubi-utils/new-utils/src/ubiformat.c

index fb4f2ee6888e0c29534e4c79a656fb6aae6506a2..7a6d1b7fadf4e2623fa23a3777241ea7644213c7 100644 (file)
@@ -342,14 +342,14 @@ static int read_all(int fd, void *buf, size_t len)
        while (len > 0) {
                ssize_t l = read(fd, buf, len);
                if (l == 0)
-                       return errmsg("eof reached; %d bytes remaining", len);
+                       return errmsg("eof reached; %zu bytes remaining", len);
                else if (l > 0) {
                        buf += l;
                        len -= l;
                } else if (errno == EINTR || errno == EAGAIN)
                        continue;
                else
-                       return sys_errmsg("reading failed; %d bytes remaining", len);
+                       return sys_errmsg("reading failed; %zu bytes remaining", len);
        }
 
        return 0;