From: Danny Al-Gaaf Date: Mon, 12 May 2014 00:33:44 +0000 (+0200) Subject: BtrfsFileStoreBackend.cc: fix ::unlinkat() result handling X-Git-Tag: v0.81~27^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1800%2Fhead;p=ceph.git BtrfsFileStoreBackend.cc: fix ::unlinkat() result handling Don't check for 'fd' but for the return value of the ::unlinkat() call. Fix for: [src/os/BtrfsFileStoreBackend.cc:72] -> [src/os/BtrfsFileStoreBackend.cc:74]: (warning) Opposite conditions in nested 'if' blocks lead to a dead code block. Signed-off-by: Danny Al-Gaaf --- diff --git a/src/os/BtrfsFileStoreBackend.cc b/src/os/BtrfsFileStoreBackend.cc index bb11a45e10b9..356084b9daa5 100644 --- a/src/os/BtrfsFileStoreBackend.cc +++ b/src/os/BtrfsFileStoreBackend.cc @@ -70,8 +70,7 @@ int BtrfsFileStoreBackend::detect_features() if (m_filestore_btrfs_clone_range) { int fd = ::openat(get_basedir_fd(), "clone_range_test", O_CREAT|O_WRONLY, 0600); if (fd >= 0) { - ::unlinkat(get_basedir_fd(), "clone_range_test", 0); - if (fd < 0) { + if (::unlinkat(get_basedir_fd(), "clone_range_test", 0) < 0) { r = -errno; dout(0) << "detect_feature: failed to unlink test file for CLONE_RANGE ioctl: " << cpp_strerror(r) << dendl;