diff options
| author | Tobias Bucher <tobiasbucher5991@gmail.com> | 2016-06-23 13:57:55 +0200 |
|---|---|---|
| committer | Tobias Bucher <tobiasbucher5991@gmail.com> | 2016-06-23 13:57:55 +0200 |
| commit | a32244b3d9a52e88e75b1540558370b532bff985 (patch) | |
| tree | e8bfca3bd63bdaf43fb1af21d6b58fdc56c2e062 /src/libstd/sys | |
| parent | 4960f2f9074d0d0f9de80b39f0b0ded6547e2ad8 (diff) | |
| download | rust-a32244b3d9a52e88e75b1540558370b532bff985.tar.gz rust-a32244b3d9a52e88e75b1540558370b532bff985.zip | |
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.
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/fd.rs | 8 |
1 files 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); } } |
