From 4d44e274dcd933327c4f1c1cc7e1f876d08ffa85 Mon Sep 17 00:00:00 2001 From: Serge Hallyn Date: Sun, 14 Apr 2013 22:57:46 -0500 Subject: [PATCH] fix coverity-found errors. Signed-off-by: Serge Hallyn --- src/lxc/conf.c | 6 ++++-- src/lxc/namespace.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) 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;