summaryrefslogtreecommitdiff
path: root/src/sys/signalfd.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/signalfd.rs')
-rw-r--r--src/sys/signalfd.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sys/signalfd.rs b/src/sys/signalfd.rs
index e3ded1f7..c43b4504 100644
--- a/src/sys/signalfd.rs
+++ b/src/sys/signalfd.rs
@@ -79,7 +79,7 @@ pub fn signalfd(fd: RawFd, mask: &SigSet, flags: SfdFlags) -> Result<RawFd> {
/// Err(err) => (), // some error happend
/// }
/// ```
-#[derive(Clone, Debug, Eq, Hash, PartialEq)]
+#[derive(Debug, Eq, Hash, PartialEq)]
pub struct SignalFd(RawFd);
impl SignalFd {
@@ -116,7 +116,10 @@ impl SignalFd {
impl Drop for SignalFd {
fn drop(&mut self) {
- let _ = unistd::close(self.0);
+ let e = unistd::close(self.0);
+ if !std::thread::panicking() && e == Err(Error::Sys(Errno::EBADF)) {
+ panic!("Closing an invalid file descriptor!");
+ };
}
}