]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
setterm: fix compiler warning
authorKarel Zak <kzak@redhat.com>
Thu, 20 Dec 2012 18:55:20 +0000 (19:55 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 20 Dec 2012 18:55:20 +0000 (19:55 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/setterm.c

index 18873f3318f5c997bce432f5baadd50a9ed9c678..1cbc979004e3a4ae917ca58046b0b6d5ddc8a1a0 100644 (file)
@@ -1159,6 +1159,7 @@ screendump(int vcnum, FILE * F)
        unsigned int rows, cols;
        int fd;
        size_t i, j;
+       ssize_t rc;
        char *inbuf, *outbuf, *p, *q;
 
        sprintf(infile, "/dev/vcsa%d", vcnum);
@@ -1188,7 +1189,8 @@ screendump(int vcnum, FILE * F)
        inbuf = xmalloc(rows * cols * 2);
        outbuf = xmalloc(rows * (cols + 1));
 
-       if (read(fd, inbuf, rows * cols * 2) != rows * cols * 2)
+       rc = read(fd, inbuf, rows * cols * 2);
+       if (rc < 0 || (size_t) rc != rows * cols * 2)
                goto read_error;
        p = inbuf;
        q = outbuf;