Skip to content

Commit 25eb716

Browse files
committed
Fixed: invalid error type for get_sector_size
1 parent 7fe4fb3 commit 25eb716

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/linux.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ pub enum BlockError {
2222
/// An error that occurs when the partition table could not be reloaded by the OS
2323
#[error(display = "failed to reload partition table of device")]
2424
RereadTable(#[error(cause)] nix::Error),
25+
/// An error that occurs when the sector size could not be retrieved from the OS
26+
#[error(display = "failed to get the sector size of device")]
27+
GetSectorSize(#[error(cause)] nix::Error),
2528
/// An error that occurs when an invalid return code has been received from an ioctl call
2629
#[error(display = "invalid return value of ioctl ({} != 0)", _0)]
2730
InvalidReturnValue(i32),
@@ -52,7 +55,7 @@ pub fn get_sector_size(file: &mut fs::File) -> Result<u64, BlockError> {
5255

5356
if metadata.st_mode() & S_IFMT == S_IFBLK {
5457
match unsafe { ioctl::blksszget(file.as_raw_fd(), &mut sector_size) } {
55-
Err(err) => Err(BlockError::RereadTable(err)),
58+
Err(err) => Err(BlockError::GetSectorSize(err)),
5659
Ok(0) => Ok(sector_size),
5760
Ok(r) => Err(BlockError::InvalidReturnValue(r)),
5861
}

0 commit comments

Comments
 (0)