]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: Check fread length
authorStéphane Graber <stgraber@ubuntu.com>
Fri, 14 Feb 2014 20:56:28 +0000 (15:56 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Sat, 15 Feb 2014 00:13:36 +0000 (19:13 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/console.c
src/lxc/lxcutmp.c

index 55e895cdf2d89509d52e7777c2ff767613b5faf2..6bfc8a34c2f7f71383ce08481340ecb03ca51032 100644 (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;
        }
index 24cfa7589e3a78026edd94af533f3edf8342b4c4..ba65654ad28d09c6f331f0908ce517aaa63b617e 100644 (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;
        }