]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
BtrfsFileStoreBackend.cc: fix ::unlinkat() result handling 1800/head
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 12 May 2014 00:33:44 +0000 (02:33 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Mon, 12 May 2014 00:33:44 +0000 (02:33 +0200)
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 <danny.al-gaaf@bisect.de>
src/os/BtrfsFileStoreBackend.cc

index bb11a45e10b9feab53b13922c21a7a651b0b6de8..356084b9daa535f6528dc7ead2c9eb00425681d6 100644 (file)
@@ -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;