win32: Misc Unix socket fixes

* Make pa_parse_address recognize Unix socket addresses with
  Windows-style absolute paths.
* Treat WASEINVAL as a stale socket.
* Make HAVE_AF_UNIX in config templates recognize winsock2.h.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/546>
This commit is contained in:
Patrick Gaskin 2021-05-30 15:25:10 -04:00 committed by PulseAudio Marge Bot
parent a01cce726f
commit 6222f610e8
3 changed files with 7 additions and 2 deletions

View file

@ -105,8 +105,13 @@ int pa_parse_address(const char *name, pa_parsed_address *ret_p) {
} else
p = name;
#ifndef OS_IS_WIN32
if (*p == '/')
ret_p->type = PA_PARSED_ADDRESS_UNIX;
#else
if (strlen(p) >= 3 && p[1] == ':' && p[2] == '\\' && ((p[0] >= 'A' && p[0] <= 'Z') || (p[0] >= 'a' && p[0] <= 'z')))
ret_p->type = PA_PARSED_ADDRESS_UNIX;
#endif
else if (pa_startswith(p, "unix:")) {
ret_p->type = PA_PARSED_ADDRESS_UNIX;
p += sizeof("unix:")-1;

View file

@ -243,7 +243,7 @@ int pa_unix_socket_is_stale(const char *fn) {
if (errno == ECONNREFUSED)
ret = 1;
#else
if (WSAGetLastError() == WSAECONNREFUSED)
if (WSAGetLastError() == WSAECONNREFUSED || WSAGetLastError() == WSAEINVAL)
ret = 1;
#endif
} else