Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: base/files/scoped_file.cc

Issue 2642483002: Relax ScopedFD close() error checking (Closed)
Patch Set: linux only Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/scoped_file.cc
diff --git a/base/files/scoped_file.cc b/base/files/scoped_file.cc
index 8ce45b8ba39e5a09ec835bdbc3fd72f735788f4b..00439aaf84cca6f89304a6975f5a5e59f8df9d56 100644
--- a/base/files/scoped_file.cc
+++ b/base/files/scoped_file.cc
@@ -34,9 +34,13 @@ void ScopedFDCloseTraits::Free(int fd) {
// TODO(davidben): Remove this once it's been determined whether
// https://crbug.com/603354 is caused by EBADF or a network filesystem
// returning some other error.
davidben 2017/01/18 20:38:26 Probably want to remove both the code and the TODO
- 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 (errno != EBADF)
+ ret = 0;
+#endif
PCHECK(0 == ret);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698