btrfs-util: make sure btrfs_get_block_device_at() works when called without path

This commit is contained in:
Lennart Poettering
2026-04-20 17:19:27 +02:00
parent a4256a9b31
commit 54ed5c5806
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -101,8 +101,7 @@ int btrfs_get_block_device_at(int dir_fd, const char *path, dev_t *ret) {
uint64_t id;
int r;
assert(dir_fd >= 0 || dir_fd == AT_FDCWD);
assert(path);
assert(dir_fd >= 0 || IN_SET(dir_fd, AT_FDCWD, XAT_FDROOT));
assert(ret);
fd = xopenat(dir_fd, path, O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
+1 -1
View File
@@ -54,7 +54,7 @@ static inline int btrfs_get_block_device(const char *path, dev_t *ret) {
return btrfs_get_block_device_at(AT_FDCWD, path, ret);
}
static inline int btrfs_get_block_device_fd(int fd, dev_t *ret) {
return btrfs_get_block_device_at(fd, "", ret);
return btrfs_get_block_device_at(fd, NULL, ret);
}
int btrfs_defrag_fd(int fd);