Skip to content

Commit 3206403

Browse files
committed
fix: only close fanotify events with a valid fd
1 parent 99a890a commit 3206403

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/sys/fanotify.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@ impl FanotifyEvent {
236236

237237
impl Drop for FanotifyEvent {
238238
fn drop(&mut self) {
239+
if self.0.fd == libc::FAN_NOFD {
240+
return;
241+
}
239242
let e = close(self.0.fd);
240243
if !std::thread::panicking() && e == Err(Errno::EBADF) {
241244
panic!("Closing an invalid file descriptor!");

0 commit comments

Comments
 (0)