summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authortschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-13 18:27:40 +0000
committertschmelcher@chromium.org <tschmelcher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-13 18:27:40 +0000
commit57b765671983005059e8be4523872796b9505428 (patch)
treec84b82b586cae2b39ef784f1ee1d58c1431bb140 /ipc
parentfd8d08436730ef67591de7665da88e995159b773 (diff)
downloadchromium_src-57b765671983005059e8be4523872796b9505428.zip
chromium_src-57b765671983005059e8be4523872796b9505428.tar.gz
chromium_src-57b765671983005059e8be4523872796b9505428.tar.bz2
Eliminate all uses of strerror() in code that uses src/base. strerror() is inherently unsafe in multi-threaded apps because it stores the string in a global buffer. It should never be used. If you want to log an error, use PLOG and friends, or if that's too high-level then use safe_strerror().
TEST=built on Linux in 32-bit and 64-bit mode; ran base_unittests in each case; ran Chromium itself in each case; try servers BUG=none Review URL: http://codereview.chromium.org/261055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28850 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_channel_posix.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index ac238ba..e8065fe 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -126,7 +126,7 @@ int ChannelNameToFD(const std::string& channel_id) {
if (fd != -1) {
int dup_fd = dup(fd);
if (dup_fd < 0)
- LOG(FATAL) << "dup(" << fd << "): " << strerror(errno);
+ PLOG(FATAL) << "dup(" << fd << ")";
return dup_fd;
}
@@ -264,9 +264,9 @@ Channel::ChannelImpl::ChannelImpl(const std::string& channel_id, Mode mode,
factory_(this) {
if (!CreatePipe(channel_id, mode)) {
// The pipe may have been closed already.
- LOG(WARNING) << "Unable to create pipe named \"" << channel_id <<
- "\" in " << (mode == MODE_SERVER ? "server" : "client") <<
- " mode error(" << strerror(errno) << ").";
+ PLOG(WARNING) << "Unable to create pipe named \"" << channel_id
+ << "\" in " << (mode == MODE_SERVER ? "server" : "client")
+ << " mode";
}
}
@@ -284,14 +284,14 @@ void RemoveAndCloseChannelSocket(const std::string& name) {
bool SocketPair(int* fd1, int* fd2) {
int pipe_fds[2];
if (socketpair(AF_UNIX, SOCK_STREAM, 0, pipe_fds) != 0) {
- LOG(ERROR) << "socketpair(): " << strerror(errno);
+ PLOG(ERROR) << "socketpair()";
return false;
}
// Set both ends to be non-blocking.
if (fcntl(pipe_fds[0], F_SETFL, O_NONBLOCK) == -1 ||
fcntl(pipe_fds[1], F_SETFL, O_NONBLOCK) == -1) {
- LOG(ERROR) << "fcntl(O_NONBLOCK): " << strerror(errno);
+ PLOG(ERROR) << "fcntl(O_NONBLOCK)";
HANDLE_EINTR(close(pipe_fds[0]));
HANDLE_EINTR(close(pipe_fds[1]));
return false;
@@ -448,7 +448,7 @@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
return false;
#endif // defined(OS_MACOSX)
} else {
- LOG(ERROR) << "pipe error (" << pipe_ << "): " << strerror(errno);
+ PLOG(ERROR) << "pipe error (" << pipe_ << ")";
return false;
}
} else if (bytes_read == 0) {
@@ -811,7 +811,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
return false;
}
#endif // OS_MACOSX
- LOG(ERROR) << "pipe error on " << fd_written << ": " << strerror(errno);
+ PLOG(ERROR) << "pipe error on " << fd_written;
return false;
}