Do not re-close files on EINTR

POSIX is unclear what state a file descriptor is in after a signal is delivered in the middle of close. On Linux, the file is closed even if it returns -1 with errno=EINTR.

As such, do not use errno at all when closing files.

PiperOrigin-RevId: 462638735
Change-Id: Ie73da1f3c83b1099bef146e1ea32e9a4818597cf
pull/1231/head
David Majnemer 3 years ago committed by Copybara-Service
parent 2c489bb5f0
commit c1deed2f44
  1. 4
      absl/debugging/symbolize_elf.inc

@ -841,7 +841,7 @@ class FileDescriptor {
~FileDescriptor() {
if (fd_ >= 0) {
NO_INTR(close(fd_));
close(fd_);
}
}
@ -1118,7 +1118,7 @@ void Symbolizer::ClearAddrMap() {
ObjFile *o = addr_map_.At(i);
base_internal::LowLevelAlloc::Free(o->filename);
if (o->fd >= 0) {
NO_INTR(close(o->fd));
close(o->fd);
}
}
addr_map_.Clear();

Loading…
Cancel
Save