ipc: hide IsRecoverableError() function behind unnamed namespace
This moves this free function inside an unnamed namespace (making its
symbol t instead of T, and thus hidding it from global) and while at
it removes its unused |err| parameter.
BUG=None
TEST=ipc_tests
[email protected]
Review URL: https://codereview.chromium.org/1632133003
Cr-Commit-Position: refs/heads/master@{#371600}
diff --git a/ipc/unix_domain_socket_util.cc b/ipc/unix_domain_socket_util.cc
index 036faa2..bfc7399 100644
--- a/ipc/unix_domain_socket_util.cc
+++ b/ipc/unix_domain_socket_util.cc
@@ -6,7 +6,6 @@
#include <errno.h>
#include <sys/socket.h>
-#include <sys/stat.h>
#include <sys/un.h>
#include <unistd.h>
@@ -67,6 +66,11 @@
return fd.release();
}
+bool IsRecoverableError() {
+ return errno == ECONNABORTED || errno == EMFILE || errno == ENFILE ||
+ errno == ENOMEM || errno == ENOBUFS;
+}
+
} // namespace
bool CreateServerUnixDomainSocket(const base::FilePath& socket_path,
@@ -172,18 +176,13 @@
return true;
}
-bool IsRecoverableError(int err) {
- return errno == ECONNABORTED || errno == EMFILE || errno == ENFILE ||
- errno == ENOMEM || errno == ENOBUFS;
-}
-
bool ServerAcceptConnection(int server_listen_fd, int* server_socket) {
DCHECK(server_socket);
*server_socket = -1;
base::ScopedFD accept_fd(HANDLE_EINTR(accept(server_listen_fd, NULL, 0)));
if (!accept_fd.is_valid())
- return IsRecoverableError(errno);
+ return IsRecoverableError();
if (!base::SetNonBlocking(accept_fd.get())) {
PLOG(ERROR) << "base::SetNonBlocking() failed " << accept_fd.get();
// It's safe to keep listening on |server_listen_fd| even if the attempt to