Skip to content

Commit a32244b

Browse files
committed
Don't ignore errors of syscalls in std::sys::unix::fd
If any of these syscalls fail, it indicates a programmer error that should not be silently ignored.
1 parent 4960f2f commit a32244b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libstd/sys/unix/fd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,29 @@ impl FileDesc {
6565
pub fn set_cloexec(&self) {
6666
unsafe {
6767
let ret = libc::ioctl(self.fd, libc::FIOCLEX);
68-
debug_assert_eq!(ret, 0);
68+
assert_eq!(ret, 0);
6969
}
7070
}
7171
#[cfg(any(target_env = "newlib", target_os = "solaris", target_os = "emscripten"))]
7272
pub fn set_cloexec(&self) {
7373
unsafe {
7474
let previous = libc::fcntl(self.fd, libc::F_GETFD);
7575
let ret = libc::fcntl(self.fd, libc::F_SETFD, previous | libc::FD_CLOEXEC);
76-
debug_assert_eq!(ret, 0);
76+
assert_eq!(ret, 0);
7777
}
7878
}
7979

8080
pub fn set_nonblocking(&self, nonblocking: bool) {
8181
unsafe {
8282
let previous = libc::fcntl(self.fd, libc::F_GETFL);
83-
debug_assert!(previous != -1);
83+
assert!(previous != -1);
8484
let new = if nonblocking {
8585
previous | libc::O_NONBLOCK
8686
} else {
8787
previous & !libc::O_NONBLOCK
8888
};
8989
let ret = libc::fcntl(self.fd, libc::F_SETFL, new);
90-
debug_assert!(ret != -1);
90+
assert!(ret != -1);
9191
}
9292
}
9393

0 commit comments

Comments
 (0)