From: Christian Brauner Date: Sat, 28 Apr 2018 22:49:30 +0000 (+0200) Subject: coverity: #1435200 X-Git-Tag: lxc-3.1.0~318^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=205fc0103b0ef16e6acaae7175e63a8b01e59494;p=thirdparty%2Flxc.git coverity: #1435200 Resource leak Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index a6e600ff9..8ba06dbb3 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -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; }