From ecc90251720bce6d190b3f1d4f52b0767be19485 Mon Sep 17 00:00:00 2001 From: Ashton Hunt Date: Sun, 7 Jul 2024 09:29:16 -0600 Subject: [PATCH] clarify `sys::unix::fd::FileDesc::drop` comment (#66876) --- std/src/os/fd/owned.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/std/src/os/fd/owned.rs b/std/src/os/fd/owned.rs index 8c7fc4cb2e453..a1f83029d2727 100644 --- a/std/src/os/fd/owned.rs +++ b/std/src/os/fd/owned.rs @@ -175,6 +175,11 @@ impl Drop for OwnedFd { // the file descriptor was closed or not, and if we retried (for // something like EINTR), we might close another valid file descriptor // opened after we closed ours. + // However, this is usually justified, as some of the major Unices + // do make sure to always close the FD, even when `close()` is interrupted, + // and the scenario is rare to begin with. + // Helpful link to an epic discussion by POSIX workgroup: + // http://austingroupbugs.net/view.php?id=529 #[cfg(not(target_os = "hermit"))] { #[cfg(unix)]