Skip to content

Commit

Permalink
In dumb_socketpair(), delete Unix-domain socket path once no longer n…
Browse files Browse the repository at this point in the history
…eeded

Small follow-up improvement to
https://gitlab.com/openconnect/openconnect/-/merge_requests/320, which made
dumb_socketpair() able to use Unix-domain sockets, on those Windows versions
that support them albeit only with named paths.

This was suggested as a way to prevent the Windows dumb_socketpair()
implementation from leaving behind size-0 files, even if normally only in
temporary directories.

See original suggestion at
microsoft/WSL#4240 (comment).

Signed-off-by: Daniel Lenski <[email protected]>
  • Loading branch information
dlenski committed Feb 3, 2022
1 parent d326bbb commit ec9d20e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@ int dumb_socketpair(OPENCONNECT_CMD_SOCKET socks[2], int make_overlapped)
goto fallback;
if (connect(socks[0], &a.addr, addrlen) == SOCKET_ERROR)
goto fallback;
if (domain == AF_UNIX)
DeleteFile(a.unaddr.sun_path); // Socket file no longer needed

socks[1] = accept(listener, NULL, NULL);
if (socks[1] == INVALID_SOCKET)
Expand Down

0 comments on commit ec9d20e

Please sign in to comment.