Coverity warns of the danger of a short read otherwise.

(Untested, but should be correct; Tossing over to you :)

Cc: S.Çağlar Onur <[email protected]>
Signed-off-by: Serge Hallyn <[email protected]>
---
 src/lxc/lxccontainer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 4ffd9a9..70a85bd 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -1556,7 +1556,7 @@ static char** lxcapi_get_interfaces(struct lxc_container 
*c)
        /* close the write-end of the pipe */
        close(pipefd[1]);
 
-       while (read(pipefd[0], &interface, IFNAMSIZ) > 0) {
+       while (read(pipefd[0], &interface, IFNAMSIZ) == IFNAMSIZ) {
                if (array_contains(&interfaces, interface, count))
                                continue;
 
@@ -1676,7 +1676,7 @@ static char** lxcapi_get_ips(struct lxc_container *c, 
const char* interface, con
        /* close the write-end of the pipe */
        close(pipefd[1]);
 
-       while (read(pipefd[0], &address, INET6_ADDRSTRLEN) > 0) {
+       while (read(pipefd[0], &address, INET6_ADDRSTRLEN) == INET6_ADDRSTRLEN) 
{
                if(!add_to_array(&addresses, address, count))
                        ERROR("PARENT: add_to_array failed");
                count++;
-- 
1.8.5.3

_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to