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

Unified Diff: base/file_util_posix.cc

Issue 100253002: Don't HANDLE_EINTR(close). Either IGNORE_EINTR(close) or just close. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 027337f32c6f90e217bc5e4cc62e2aefca5b7a49..31c85a0b616d35b96020e99ffe222fdc6d75548e 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -442,7 +442,7 @@ bool CreateTemporaryFile(FilePath* path) {
int fd = CreateAndOpenFdForTemporaryFile(directory, path);
if (fd < 0)
return false;
- ignore_result(HANDLE_EINTR(close(fd)));
+ close(fd);
return true;
}
@@ -461,14 +461,14 @@ FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) {
FILE* file = fdopen(fd, "a+");
if (!file)
- ignore_result(HANDLE_EINTR(close(fd)));
+ close(fd);
return file;
}
bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) {
base::ThreadRestrictions::AssertIOAllowed(); // For call to close().
int fd = CreateAndOpenFdForTemporaryFile(dir, temp_file);
- return ((fd >= 0) && !HANDLE_EINTR(close(fd)));
+ return ((fd >= 0) && !IGNORE_EINTR(close(fd)));
}
static bool CreateTemporaryDirInDirImpl(const FilePath& base_dir,
@@ -644,7 +644,7 @@ int ReadFile(const FilePath& filename, char* data, int size) {
return -1;
ssize_t bytes_read = HANDLE_EINTR(read(fd, data, size));
- if (int ret = HANDLE_EINTR(close(fd)) < 0)
+ if (int ret = IGNORE_EINTR(close(fd)) < 0)
return ret;
return bytes_read;
}
@@ -656,7 +656,7 @@ int WriteFile(const FilePath& filename, const char* data, int size) {
return -1;
int bytes_written = WriteFileDescriptor(fd, data, size);
- if (int ret = HANDLE_EINTR(close(fd)) < 0)
+ if (int ret = IGNORE_EINTR(close(fd)) < 0)
return ret;
return bytes_written;
}
@@ -683,7 +683,7 @@ int AppendToFile(const FilePath& filename, const char* data, int size) {
return -1;
int bytes_written = WriteFileDescriptor(fd, data, size);
- if (int ret = HANDLE_EINTR(close(fd)) < 0)
+ if (int ret = IGNORE_EINTR(close(fd)) < 0)
return ret;
return bytes_written;
}
@@ -935,7 +935,7 @@ bool CopyFileUnsafe(const FilePath& from_path, const FilePath& to_path) {
int outfile = HANDLE_EINTR(creat(to_path.value().c_str(), 0666));
if (outfile < 0) {
- ignore_result(HANDLE_EINTR(close(infile)));
+ close(infile);
return false;
}
@@ -966,9 +966,9 @@ bool CopyFileUnsafe(const FilePath& from_path, const FilePath& to_path) {
} while (bytes_written_per_read < bytes_read);
}
- if (HANDLE_EINTR(close(infile)) < 0)
+ if (IGNORE_EINTR(close(infile)) < 0)
result = false;
- if (HANDLE_EINTR(close(outfile)) < 0)
+ if (IGNORE_EINTR(close(outfile)) < 0)
result = false;
return result;
« no previous file with comments | « base/file_util.h ('k') | base/files/dir_reader_linux.h » ('j') | base/posix/eintr_wrapper.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698