From a32244b3d9a52e88e75b1540558370b532bff985 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Thu, 23 Jun 2016 13:57:55 +0200 Subject: [PATCH] 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. --- src/libstd/sys/unix/fd.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstd/sys/unix/fd.rs b/src/libstd/sys/unix/fd.rs index 94c48be02ff..bbc9531d1da 100644 --- a/src/libstd/sys/unix/fd.rs +++ b/src/libstd/sys/unix/fd.rs @@ -65,7 +65,7 @@ impl FileDesc { pub fn set_cloexec(&self) { unsafe { let ret = libc::ioctl(self.fd, libc::FIOCLEX); - debug_assert_eq!(ret, 0); + assert_eq!(ret, 0); } } #[cfg(any(target_env = "newlib", target_os = "solaris", target_os = "emscripten"))] @@ -73,21 +73,21 @@ impl FileDesc { unsafe { let previous = libc::fcntl(self.fd, libc::F_GETFD); let ret = libc::fcntl(self.fd, libc::F_SETFD, previous | libc::FD_CLOEXEC); - debug_assert_eq!(ret, 0); + assert_eq!(ret, 0); } } pub fn set_nonblocking(&self, nonblocking: bool) { unsafe { let previous = libc::fcntl(self.fd, libc::F_GETFL); - debug_assert!(previous != -1); + assert!(previous != -1); let new = if nonblocking { previous | libc::O_NONBLOCK } else { previous & !libc::O_NONBLOCK }; let ret = libc::fcntl(self.fd, libc::F_SETFL, new); - debug_assert!(ret != -1); + assert!(ret != -1); } }