Fixes misleading "connect: Connection failed" message on start up

When launching the first instance of fish and fishd is not launched already, this should not be considered an error as long as it can be launched. So ignore the first failure of connect(), as the calling function get_socket() will try again. May need a bit of cleanup.
This commit is contained in:
bot47 2013-11-14 09:46:55 +01:00
parent 14b6d32fe6
commit cfbb511d26

View file

@ -132,7 +132,12 @@ static int try_get_socket_once(void)
if (connect(s, (struct sockaddr *)&local, sizeof local) == -1) if (connect(s, (struct sockaddr *)&local, sizeof local) == -1)
{ {
close(s); close(s);
wperror(L"connect");
/* If it fails on first try, it's probably no serious error, but fishd hasn't been launched yet.
This happens (at least) on the first concurrent session. */
if (get_socket_count > 1)
wperror(L"connect");
return -1; return -1;
} }