servers: accept unlink() failing due to the file missing

In `bind_unix_socket()`, before retrying `bind()`.

This patch uses `ENOENT`. This was last time in source between
d25b050379 (2018) and
dffd996e3b (2023), and also earlier. Also
defined by supported Windows envs. Seems safe to use.

Reported-by CodeQL
Follow-up to 99fb36797a
Cherry-picked from #22010

Closes #22028
This commit is contained in:
Viktor Szakats 2026-06-15 15:08:09 +02:00
parent 6ce740403e
commit 7d09426187
No known key found for this signature in database

View file

@ -711,7 +711,7 @@ int bind_unix_socket(curl_socket_t sock, const char *unix_socket,
}
#endif
/* dead socket, cleanup and retry bind */
if(unlink(unix_socket)) {
if(unlink(unix_socket) && errno != ENOENT) {
logmsg("Error binding socket, failed to unlink %s: %d (%s)", unix_socket,
errno, curlx_strerror(errno, errbuf, sizeof(errbuf)));
return -1;