diff options
| -rw-r--r-- | runtime/base/unix_file/fd_file.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/runtime/base/unix_file/fd_file.cc b/runtime/base/unix_file/fd_file.cc index 58b047fe45..792c58172e 100644 --- a/runtime/base/unix_file/fd_file.cc +++ b/runtime/base/unix_file/fd_file.cc @@ -163,13 +163,18 @@ int FdFile::Close() { moveUp(GuardState::kClosed, nullptr); } +#if defined(__linux__) + // close always succeeds on linux, even if failure is reported. + UNUSED(result); +#else if (result == -1) { return -errno; - } else { - fd_ = -1; - file_path_ = ""; - return 0; } +#endif + + fd_ = -1; + file_path_ = ""; + return 0; } int FdFile::Flush() { |