Skip to content

Commit

Permalink
Fix Windows unlink warning
Browse files Browse the repository at this point in the history
  • Loading branch information
uNetworkingAB committed Nov 4, 2022
1 parent 89ad4cb commit 760a024
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,11 @@ LIBUS_SOCKET_DESCRIPTOR bsd_create_listen_socket_unix(const char *path, int opti
server_address.sun_family = AF_UNIX;
strcpy(server_address.sun_path, path);
int size = offsetof(struct sockaddr_un, sun_path) + strlen(server_address.sun_path);
#ifdef _WIN32
_unlink(path);
#else
unlink(path);
#endif

if (bind(listenFd, (struct sockaddr *)&server_address, size) || listen(listenFd, 512)) {
bsd_close_socket(listenFd);
Expand Down

0 comments on commit 760a024

Please sign in to comment.