Bubble up the errors in set_nonblocking
and set_cloexec
This commit is contained in:
parent
a32244b3d9
commit
9347ffcf5c
4 changed files with 30 additions and 30 deletions
|
@ -77,7 +77,7 @@ impl Socket {
|
|||
|
||||
let fd = cvt(libc::socket(fam, ty, 0))?;
|
||||
let fd = FileDesc::new(fd);
|
||||
fd.set_cloexec();
|
||||
fd.set_cloexec()?;
|
||||
Ok(Socket(fd))
|
||||
}
|
||||
}
|
||||
|
@ -99,9 +99,9 @@ impl Socket {
|
|||
|
||||
cvt(libc::socketpair(fam, ty, 0, fds.as_mut_ptr()))?;
|
||||
let a = FileDesc::new(fds[0]);
|
||||
a.set_cloexec();
|
||||
let b = FileDesc::new(fds[1]);
|
||||
b.set_cloexec();
|
||||
a.set_cloexec()?;
|
||||
b.set_cloexec()?;
|
||||
Ok((Socket(a), Socket(b)))
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ impl Socket {
|
|||
libc::accept(self.0.raw(), storage, len)
|
||||
})?;
|
||||
let fd = FileDesc::new(fd);
|
||||
fd.set_cloexec();
|
||||
fd.set_cloexec()?;
|
||||
Ok(Socket(fd))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue