diff options
author | Kenneth Myhra <kennethmyhra@gmail.com> | 2023-01-07 21:03:00 +0100 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-01-08 15:19:59 +0000 |
commit | b6917bc8861f52755e6ecd9c407e58368f75b2cd (patch) | |
tree | 6e2ed207d1add081d56502040fced6b5f47662e1 /Userland/Utilities | |
parent | a7dafaccedab6fd7ac5c12616a75afe04f374188 (diff) | |
download | serenity-b6917bc8861f52755e6ecd9c407e58368f75b2cd.zip |
blockdev: Use Core::System::open() instead of LibC open()
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/blockdev.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Userland/Utilities/blockdev.cpp b/Userland/Utilities/blockdev.cpp index 06fb42085d..8e3d574f02 100644 --- a/Userland/Utilities/blockdev.cpp +++ b/Userland/Utilities/blockdev.cpp @@ -24,7 +24,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::unveil(nullptr, nullptr)); TRY(Core::System::pledge("stdio rpath")); - char const* device = nullptr; + StringView device; bool flag_get_disk_size = false; bool flag_get_block_size = false; @@ -36,11 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_positional_argument(device, "Device to query", "device"); args_parser.parse(arguments); - int fd = open(device, O_RDONLY); - if (fd < 0) { - perror("open"); - return 1; - } + int fd = TRY(Core::System::open(device, O_RDONLY)); if (flag_get_disk_size) { TRY(fetch_ioctl(fd, STORAGE_DEVICE_GET_SIZE)); |