diff options
Diffstat (limited to 'base/shared_memory_posix.cc')
-rw-r--r-- | base/shared_memory_posix.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index 4793627..bd2c6e5 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -79,7 +79,8 @@ SharedMemoryHandle SharedMemory::NULLHandle() { // static void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { DCHECK(handle.fd >= 0); - close(handle.fd); + if (HANDLE_EINTR(close(handle.fd)) < 0) + PLOG(ERROR) << "close"; } bool SharedMemory::CreateAndMapAnonymous(uint32 size) { @@ -98,7 +99,7 @@ bool SharedMemory::CreateAnonymous(uint32 size) { // of mem_filename after FilePathForMemoryName(). bool SharedMemory::CreateNamed(const std::string& name, bool open_existing, uint32 size) { - DCHECK(mapped_file_ == -1); + DCHECK_EQ(-1, mapped_file_); if (size == 0) return false; // This function theoretically can block on the disk, but realistically @@ -229,7 +230,8 @@ void SharedMemory::Close() { Unmap(); if (mapped_file_ > 0) { - close(mapped_file_); + if (HANDLE_EINTR(close(mapped_file_)) < 0) + PLOG(ERROR) << "close"; mapped_file_ = -1; } } @@ -247,7 +249,7 @@ void SharedMemory::Unlock() { } bool SharedMemory::PrepareMapFile(FILE *fp) { - DCHECK(mapped_file_ == -1); + DCHECK_EQ(-1, mapped_file_); if (fp == NULL) return false; // This function theoretically can block on the disk, but realistically @@ -282,8 +284,8 @@ bool SharedMemory::FilePathForMemoryName(const std::string& mem_name, FilePath* path) { // mem_name will be used for a filename; make sure it doesn't // contain anything which will confuse us. - DCHECK(mem_name.find('/') == std::string::npos); - DCHECK(mem_name.find('\0') == std::string::npos); + DCHECK_EQ(std::string::npos, mem_name.find('/')); + DCHECK_EQ(std::string::npos, mem_name.find('\0')); FilePath temp_dir; if (!file_util::GetShmemTempDir(&temp_dir)) |