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>
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;