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;