]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix coverity-found errors.
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 15 Apr 2013 03:57:46 +0000 (22:57 -0500)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 15 Apr 2013 03:57:46 +0000 (22:57 -0500)
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c
src/lxc/namespace.c

index b6bdd936ba9f11045d3cb17f2f00570d055150d3..c416da5fa4c0f54941f9d33c04cd627705905866 100644 (file)
@@ -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");
index 6447054720f8991de8b96db0b675946765617960..cc237920f96a568bcc6a5d5bcc6a9fb0f747467f 100644 (file)
@@ -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;