Skip to content

Commit

Permalink
if FIFO stdin set non-block, process in container may open stdin by b…
Browse files Browse the repository at this point in the history
…lock method and it will cause WouldBlock error when it read from stdin
  • Loading branch information
jingxu.zm committed May 24, 2024
1 parent 200f788 commit 5761974
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/runc/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,14 @@ impl Io for FIFO {
.read(true)
.custom_flags(libc::O_NONBLOCK)
.open(path)?;
unsafe {
let cur_flag = libc::fcntl(stdin.as_raw_fd(), libc::F_GETFL);
libc::fcntl(
stdin.as_raw_fd(),
libc::F_SETFL,
cur_flag & !libc::O_NONBLOCK,
);
}
cmd.stdin(stdin);
}

Expand Down

0 comments on commit 5761974

Please sign in to comment.