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

Unified Diff: mojo/shell/incoming_connection_listener_posix.cc

Issue 611833005: Force creation of application listening socket (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flag
Patch Set: Created 6 years, 3 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 | mojo/shell/incoming_connection_listener_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/incoming_connection_listener_posix.cc
diff --git a/mojo/shell/incoming_connection_listener_posix.cc b/mojo/shell/incoming_connection_listener_posix.cc
index 820917b8da5bc79be290bbfaea1a6b836e4af3c1..8684d157499c481c7e475b523ee40db2feead986 100644
--- a/mojo/shell/incoming_connection_listener_posix.cc
+++ b/mojo/shell/incoming_connection_listener_posix.cc
@@ -47,15 +47,15 @@ void IncomingConnectionListenerPosix::StartListening() {
DCHECK(listen_thread_checker_.CalledOnValidThread());
int rv = net::OK;
- if (base::PathExists(socket_path_)) {
- LOG(ERROR) << "Listening socket file already exists.";
- rv = net::ERR_FILE_EXISTS;
- } else if (!base::DirectoryExists(socket_path_.DirName())) {
+ if (!base::DirectoryExists(socket_path_.DirName())) {
LOG(ERROR) << "Directorty for listening socket does not exist.";
rv = net::ERR_FILE_NOT_FOUND;
} else if (!base::PathIsWritable(socket_path_.DirName())) {
LOG(ERROR) << "Listening socket file path is not writable.";
rv = net::ERR_ACCESS_DENIED;
+ } else if (!base::DeleteFile(socket_path_, false)) {
+ PLOG(ERROR) << "Listening socket file exists and can't be deleted";
+ rv = net::ERR_FILE_EXISTS;
} else {
const std::string& socket_address = socket_path_.value();
rv = listen_socket_.ListenWithAddressAndPort(socket_address, 0, 100);
« no previous file with comments | « no previous file | mojo/shell/incoming_connection_listener_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698