From 1a76c3c21755affb3b92ca10e778507f0fa83c22 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Wed, 30 Jun 2021 17:33:38 -0400 Subject: [PATCH] Fix incorrect comment on abort_internal This was wrong in several ways: 1. abort() still calls signal handlers 2. abort() no longer flushes streams (since glibc 2.27) Rather than trying to keep it up-to-date with the man page, it now just says "behaves the same as libc's abort". --- library/std/src/sys/unix/mod.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 27d44abeb74c5..8bdd195ad987a 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -195,13 +195,11 @@ pub fn cvt_nz(error: libc::c_int) -> crate::io::Result<()> { if error == 0 { Ok(()) } else { Err(crate::io::Error::from_raw_os_error(error)) } } -// On Unix-like platforms, libc::abort will unregister signal handlers -// including the SIGABRT handler, preventing the abort from being blocked, and -// fclose streams, with the side effect of flushing them so libc buffered -// output will be printed. Additionally the shell will generally print a more -// understandable error message like "Abort trap" rather than "Illegal -// instruction" that intrinsics::abort would cause, as intrinsics::abort is -// implemented as an illegal instruction. +/// On Unix-like platforms, this calls abort (3) directly. +/// +/// The shell will generally print a more understandable error message like +/// "Abort trap" rather than "Illegal instruction" that intrinsics::abort would +/// cause, as intrinsics::abort is implemented as an illegal instruction. pub fn abort_internal() -> ! { unsafe { libc::abort() } }