Index: base/files/scoped_file.cc |
diff --git a/base/files/scoped_file.cc b/base/files/scoped_file.cc |
index 8ce45b8ba39e5a09ec835bdbc3fd72f735788f4b..78d4ca52634d5d0275edd2e710f203ef7f3c8592 100644 |
--- a/base/files/scoped_file.cc |
+++ b/base/files/scoped_file.cc |
@@ -37,6 +37,14 @@ void ScopedFDCloseTraits::Free(int fd) { |
int close_errno = errno; |
base::debug::Alias(&close_errno); |
+#if defined(OS_LINUX) |
+ // NB: Some file descriptors can return errors from close() e.g. network |
+ // filesystems such as NFS and Linux input devices. On Linux, errors from |
+ // close other than EBADF do not indicate failure to actually close the fd. |
+ if (ret != 0 && errno != EBADF) |
+ ret = 0; |
+#endif |
+ |
PCHECK(0 == ret); |
} |