]> git.hungrycats.org Git - bees/commitdiff
hash: handle $BEESHOME on btrfs too
authorZygo Blaxell <bees@furryterror.org>
Tue, 18 Feb 2025 02:12:29 +0000 (21:12 -0500)
committerZygo Blaxell <bees@furryterror.org>
Tue, 18 Feb 2025 02:18:08 +0000 (21:18 -0500)
The `_nothrow` variants of `do_ioctl` return true when they succeed,
which is the opposite of what `ioctl` does.

Fix the logic so bees can correctly identify its own hash table when
it's on the same filesystem as the target.

Fixes: f6908420adcf3fbafef8bbde8a25f8bac65424b6 ("hash: handle $BEESHOME on non-btrfs")
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
src/bees-hash.cc

index 88e184abe8d434e5127dd23d03cfc013469c957e..7581fe14d1338d35e79ee1d70f5d9fe90c7bfed7 100644 (file)
@@ -819,7 +819,8 @@ BeesHashTable::BeesHashTable(shared_ptr<BeesContext> ctx, string filename, off_t
                root_info.do_ioctl(m_ctx->root_fd());
                // Hash might not be a btrfs
                BtrfsIoctlFsInfoArgs hash_info;
-               if (hash_info.do_ioctl_nothrow(m_fd)) return;
+               // If btrfs fs_info ioctl fails, it must be a different fs
+               if (!hash_info.do_ioctl_nothrow(m_fd)) return;
                // If Hash is a btrfs, Root must be the same one
                if (root_info.fsid() != hash_info.fsid()) return;
                // Hash is on the same one, blacklist it