btrfs-util: make sure btrfs_get_block_device_at() works when called without path
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user