From: Serge Hallyn Date: Mon, 15 Apr 2013 03:57:46 +0000 (-0500) Subject: fix coverity-found errors. X-Git-Tag: lxc-1.0.0.alpha1~1^2~299 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d44e274dcd933327c4f1c1cc7e1f876d08ffa85;p=thirdparty%2Flxc.git fix coverity-found errors. Signed-off-by: Serge Hallyn --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index b6bdd936b..c416da5fa 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -700,7 +700,8 @@ static int setup_tty(const struct lxc_rootfs *rootfs, SYSERROR("error creating %s\n", lxcpath); return -1; } - close(ret); + if (ret >= 0) + close(ret); ret = unlink(path); if (ret && errno != ENOENT) { SYSERROR("error unlinking %s\n", path); @@ -1314,7 +1315,8 @@ static int setup_ttydir_console(const struct lxc_rootfs *rootfs, SYSERROR("error %d creating %s\n", errno, lxcpath); return -1; } - close(ret); + if (ret >= 0) + close(ret); if (console->peer == -1) { INFO("no console output required"); diff --git a/src/lxc/namespace.c b/src/lxc/namespace.c index 644705472..cc237920f 100644 --- a/src/lxc/namespace.c +++ b/src/lxc/namespace.c @@ -53,7 +53,7 @@ pid_t lxc_clone(int (*fn)(void *), void *arg, int flags) .arg = arg, }; - long stack_size = sysconf(_SC_PAGESIZE); + size_t stack_size = sysconf(_SC_PAGESIZE); void *stack = alloca(stack_size); pid_t ret;