Skip to content

Commit 7e73f17

Browse files
committed
Fix typo
1 parent 8f969b1 commit 7e73f17

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tokio/src/fs/read.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ async fn read_uring(path: &Path) -> io::Result<Vec<u8>> {
7777

7878
let file = OpenOptions::new().read(true).open(path).await?;
7979

80-
let size = 0;
80+
let size = file
81+
.metadata()
82+
.await
83+
.map(|m| m.len() as usize)
84+
.ok()
85+
.unwrap_or(0);
8186

8287
let mut buf = Vec::with_capacity(size);
8388

0 commit comments

Comments
 (0)