Commit c1deed2f by David Majnemer Committed by Copybara-Service

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
parent 2c489bb5
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment