From: Karel Zak Date: Thu, 20 Dec 2012 18:55:20 +0000 (+0100) Subject: setterm: fix compiler warning X-Git-Tag: v2.23-rc1~393 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=747c1d9d57130aab172a3e284d84c99463392758;p=thirdparty%2Futil-linux.git setterm: fix compiler warning Signed-off-by: Karel Zak --- diff --git a/term-utils/setterm.c b/term-utils/setterm.c index 18873f3318..1cbc979004 100644 --- a/term-utils/setterm.c +++ b/term-utils/setterm.c @@ -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;