Skip to content

Commit abb879d

Browse files
committed
fix(driver): set cloexec for file
1 parent 64ed318 commit abb879d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

compio-driver/src/iour/op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<
4545
impl OpCode for OpenFile {
4646
fn create_entry(self: Pin<&mut Self>) -> OpEntry {
4747
opcode::OpenAt::new(Fd(libc::AT_FDCWD), self.path.as_ptr())
48-
.flags(self.flags)
48+
.flags(self.flags | libc::O_CLOEXEC)
4949
.mode(self.mode)
5050
.build()
5151
.into()

compio-driver/src/poll/op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl OpCode for OpenFile {
5656
fn operate(self: Pin<&mut Self>) -> Poll<io::Result<usize>> {
5757
Poll::Ready(Ok(syscall!(open(
5858
self.path.as_ptr(),
59-
self.flags,
59+
self.flags | libc::O_CLOEXEC,
6060
self.mode as libc::c_int
6161
))? as _))
6262
}

0 commit comments

Comments
 (0)