From: Stéphane Graber Date: Fri, 14 Feb 2014 20:56:28 +0000 (-0500) Subject: coverity: Check fread length X-Git-Tag: lxc-1.0.0.rc2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9de2ebe99503be25dee9ef327e9e16d3ed85fc5d;p=thirdparty%2Flxc.git coverity: Check fread length Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/console.c b/src/lxc/console.c index 55e895cdf..6bfc8a34c 100644 --- a/src/lxc/console.c +++ b/src/lxc/console.c @@ -116,7 +116,7 @@ static int lxc_console_cb_sigwinch_fd(int fd, uint32_t events, void *cbdata, struct signalfd_siginfo siginfo; struct lxc_tty_state *ts = cbdata; - if (read(fd, &siginfo, sizeof(siginfo)) < 0) { + if (read(fd, &siginfo, sizeof(siginfo)) < sizeof(siginfo)) { ERROR("failed to read signal info"); return -1; } diff --git a/src/lxc/lxcutmp.c b/src/lxc/lxcutmp.c index 24cfa7589..ba65654ad 100644 --- a/src/lxc/lxcutmp.c +++ b/src/lxc/lxcutmp.c @@ -167,7 +167,7 @@ static int utmp_handler(int fd, uint32_t events, void *data, return -1; } - if (read(fd, buffer, size) < 0) { + if (read(fd, buffer, size) < size) { SYSERROR("failed to read notification"); return -1; }