From 3d7f527cbd974d8f5e5837c4a1f24c7bacc46cac Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Mon, 12 May 2014 02:33:44 +0200 Subject: [PATCH] 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 --- src/os/BtrfsFileStoreBackend.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/os/BtrfsFileStoreBackend.cc b/src/os/BtrfsFileStoreBackend.cc index bb11a45e10b9f..356084b9daa53 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; -- 2.39.5