coverity: Check fread length

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Stéphane Graber 2014-02-14 15:56:28 -05:00
parent 7eb44573b0
commit 9de2ebe995
2 changed files with 2 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}