Skip to content

Commit f4c97c2

Browse files
committed
Fix typo
1 parent d983ed7 commit f4c97c2

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)