Skip to content

Commit 93f411e

Browse files
committed
handle EINT in tokio::fs::write for io-uring
1 parent 08f4065 commit 93f411e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tokio/src/fs/write.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ async fn write_uring(path: &Path, mut buf: OwnedBuf) -> io::Result<()> {
7373
let mut file_offset: u64 = 0;
7474
while buf_offset < total {
7575
let (n, _buf, _fd) = Op::write_at(fd, buf, buf_offset, file_offset)?.await;
76-
// TODO: handle EINT here
77-
let n = n?;
78-
if n == 0 {
79-
return Err(io::ErrorKind::WriteZero.into());
80-
}
76+
77+
let n = match n {
78+
Ok(0) => return Err(io::ErrorKind::WriteZero.into()),
79+
Ok(n) => n,
80+
Err(e) if e.kind() == io::ErrorKind::Interrupted => 0,
81+
Err(e) => return Err(e),
82+
};
8183

8284
buf = _buf;
8385
fd = _fd;

0 commit comments

Comments
 (0)