Skip to content

Commit

Permalink
Bug 1162524: Fix error handling |UnixSocketWatcher::Connect|, r=kmach…
Browse files Browse the repository at this point in the history
…ulis

With this patch, it's not an error if the connection operations
stalls on a non-blocking socket; so don't return an error code.

The patch also makes |connect| restart if it was aborted by a
signal.
  • Loading branch information
tdz committed May 8, 2015
1 parent 8a6a2a4 commit 7f93be6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ipc/unixfd/UnixSocketWatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ UnixSocketWatcher::Connect(const struct sockaddr* aAddr, socklen_t aAddrLen)
MOZ_ASSERT(IsOpen());
MOZ_ASSERT(aAddr || !aAddrLen);

if (connect(GetFd(), aAddr, aAddrLen) < 0) {
if (TEMP_FAILURE_RETRY(connect(GetFd(), aAddr, aAddrLen) < 0)) {
if (errno == EINPROGRESS) {
mConnectionStatus = SOCKET_IS_CONNECTING;
// Set up a write watch to receive the connect signal
AddWatchers(WRITE_WATCHER, false);
} else {
OnError("connect", errno);
return NS_OK;
}
OnError("connect", errno);
return NS_ERROR_FAILURE;
}

Expand Down

0 comments on commit 7f93be6

Please sign in to comment.