[pack/unpack] fix bug in file_utils::file_size()

This commit is contained in:
Joe Thornber 2020-06-10 15:07:40 +01:00
parent 380632565d
commit f90010e22a

View File

@ -41,8 +41,8 @@ pub fn fail<T>(msg: &str) -> io::Result<T> {
} }
fn get_device_size(path: &str) -> io::Result<u64> { fn get_device_size(path: &str) -> io::Result<u64> {
let _file = File::open(path)?; let file = File::open(path)?;
let fd = File::open(path).unwrap().as_raw_fd(); let fd = file.as_raw_fd();
let mut cap = 0u64; let mut cap = 0u64;
unsafe { unsafe {
match ioctl_blkgetsize64(fd, &mut cap) { match ioctl_blkgetsize64(fd, &mut cap) {