diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-27 22:56:25 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-08-28 03:10:50 +0200 |
commit | ca8228295ec20e561119729a2cf117e4531d7f56 (patch) | |
tree | d31f8189834a0f126b68dcdb976b66bd4ffdbd23 /src/shared/blockdev-util.c | |
parent | sd-device: skip to check diskseq if device is not initialized (diff) | |
download | systemd-ca8228295ec20e561119729a2cf117e4531d7f56.tar.xz systemd-ca8228295ec20e561119729a2cf117e4531d7f56.zip |
tree-wide: use devpath_from_devnum() and device_open_from_devnum()
Fixes #24465.
Diffstat (limited to 'src/shared/blockdev-util.c')
-rw-r--r-- | src/shared/blockdev-util.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/shared/blockdev-util.c b/src/shared/blockdev-util.c index 0d921cc045..6038591d83 100644 --- a/src/shared/blockdev-util.c +++ b/src/shared/blockdev-util.c @@ -221,7 +221,6 @@ int get_block_device_harder(const char *path, dev_t *ret) { } int lock_whole_block_device(dev_t devt, int operation) { - _cleanup_free_ char *whole_node = NULL; _cleanup_close_ int lock_fd = -1; dev_t whole_devt; int r; @@ -232,14 +231,10 @@ int lock_whole_block_device(dev_t devt, int operation) { if (r < 0) return r; - r = device_path_make_major_minor(S_IFBLK, whole_devt, &whole_node); + lock_fd = r = device_open_from_devnum(S_IFBLK, whole_devt, O_RDONLY|O_CLOEXEC|O_NONBLOCK, NULL); if (r < 0) return r; - lock_fd = open(whole_node, O_RDONLY|O_CLOEXEC|O_NONBLOCK); - if (lock_fd < 0) - return -errno; - if (flock(lock_fd, operation) < 0) return -errno; |