seq_packet: set SOCK_NONBLOCK on accept

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-07-07 15:17:10 +02:00
parent a747328ef3
commit ff22261dde

View File

@ -47,7 +47,12 @@ impl SeqPacketListener {
let fd = self.as_raw_fd();
let res = self.fd.wrap_read(cx, || {
c_result!(unsafe {
libc::accept4(fd, ptr::null_mut(), ptr::null_mut(), libc::SOCK_CLOEXEC)
libc::accept4(
fd,
ptr::null_mut(),
ptr::null_mut(),
libc::SOCK_CLOEXEC | libc::SOCK_NONBLOCK,
)
})
.map(|fd| unsafe { Fd::from_raw_fd(fd as RawFd) })
});