]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
coverity: #1435200
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 28 Apr 2018 22:49:30 +0000 (00:49 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 28 Apr 2018 22:49:30 +0000 (00:49 +0200)
Resource leak

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index a6e600ff93dc7a780c78106361e50c22345d889a..8ba06dbb34661d97f04b62ff4def218d54f2dc94 100644 (file)
@@ -562,10 +562,6 @@ int pin_rootfs(const char *rootfs)
        if (!realpath(rootfs, absrootfs))
                return -2;
 
-       ret = access(absrootfs, F_OK);
-       if (ret != 0)
-               return -1;
-
        ret = stat(absrootfs, &s);
        if (ret < 0)
                return -1;
@@ -581,12 +577,12 @@ int pin_rootfs(const char *rootfs)
        if (fd < 0)
                return fd;
 
-       if (fstatfs (fd, &sfs)) {
-               return -1;
-       }
+       ret = fstatfs (fd, &sfs);
+       if (ret < 0)
+               return fd;
 
        if (sfs.f_type == NFS_SUPER_MAGIC) {
-               DEBUG("rootfs on NFS, not unlinking pin file \"%s\".", absrootfspin);
+               DEBUG("Rootfs on NFS, not unlinking pin file \"%s\"", absrootfspin);
                return fd;
        }