win32: Check WSAGetLastError() in pa_is_unix_socket_stale.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/360>
This commit is contained in:
Edward Lee 2020-10-01 10:10:19 -04:00 committed by Arun Raghavan
parent 68cb06b5fd
commit 4e5786ffdd

View file

@ -239,8 +239,13 @@ int pa_unix_socket_is_stale(const char *fn) {
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
if (connect(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
#if !defined(OS_IS_WIN32)
if (errno == ECONNREFUSED)
ret = 1;
#else
if (WSAGetLastError() == WSAECONNREFUSED)
ret = 1;
#endif
} else
ret = 0;