From 12af3bad4cf302ffad84b192c388de63a2b1c12e Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Wed, 18 Aug 2004 17:05:12 +0000 Subject: Only unlink socket when a UNIX type --- daemon/httpauthd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/daemon/httpauthd.c b/daemon/httpauthd.c index ad2f365..b471094 100644 --- a/daemon/httpauthd.c +++ b/daemon/httpauthd.c @@ -246,7 +246,6 @@ int main(int argc, char* argv[]) if(!threads) errx(1, "out of memory"); - /* TODO: Import the new sock_any from clamsmtp */ /* Get the socket type */ if(sock_any_pton(g_socket, &sany, DEFAULT_PORT) == -1) errx(1, "invalid socket name or ip: %s", g_socket); @@ -260,8 +259,8 @@ int main(int argc, char* argv[]) setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&i, sizeof(i)); /* Unlink the socket file if it exists */ - /* TODO: Is this safe? */ - unlink(g_socket); + if(SANY_TYPE(sany) == AF_UNIX) + unlink(g_socket); if(bind(sock, &SANY_ADDR(sany), SANY_LEN(sany)) != 0) err(1, "couldn't bind to address: %s", g_socket); -- cgit v1.2.3