From 7d09426187a1a0e3ad735fc257c6b8eed3612f9a Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 15 Jun 2026 15:08:09 +0200 Subject: [PATCH] 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 d25b0503795f1fbf557632ce870298f52f2a78c1 (2018) and dffd996e3b54a0c9314b1c93c7f837a5b2b1fc3d (2023), and also earlier. Also defined by supported Windows envs. Seems safe to use. Reported-by CodeQL Follow-up to 99fb36797a3f0b64ad20fcb8b83026875640f8e0 Cherry-picked from #22010 Closes #22028 --- tests/server/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/server/util.c b/tests/server/util.c index dd4e9bacdb..78c954b1cf 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -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;