From 751bf8779a1be85adebbace70366c96127b9f9d8 Mon Sep 17 00:00:00 2001 From: teodor Date: Mon, 3 Dec 2007 15:15:28 +0000 Subject: [PATCH] Correct use HAVE_HSTRERROR --- connection.h | 5 +++++ tcp.c | 4 ---- udp.c | 8 -------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/connection.h b/connection.h index 572e357..9aba67f 100644 --- a/connection.h +++ b/connection.h @@ -166,5 +166,10 @@ void TC_addConnection(PoolConnection *pool, TC_Connection *c); void TC_deleteConnectionByN(PoolConnection *pool, int n); void TC_deleteConnectionByC(PoolConnection *pool, TC_Connection *c); +#ifndef HAVE_HSTRERROR +#define hstrerror strerror +#define h_errno errno +#endif + #endif diff --git a/tcp.c b/tcp.c index 112e98a..a9295e4 100644 --- a/tcp.c +++ b/tcp.c @@ -171,11 +171,7 @@ TC_fillConnection(TC_Connection *sc, char *name, u_int32_t port) { memcpy(&sc->serv_addr.sin_addr.s_addr, host->h_addr_list[0], sizeof(&sc->serv_addr.sin_addr.s_addr)); } else { -#ifdef HAVE_HSTRERROR tlog(TL_CRIT,"gethostbyname: %s - %s", name, hstrerror(h_errno)); -#else - tlog(TL_CRIT,"gethostbyname: %s - %s", name, strerror(errno)); -#endif sc->state = CS_ERROR; return sc; } diff --git a/udp.c b/udp.c index 9c212af..424860b 100644 --- a/udp.c +++ b/udp.c @@ -69,11 +69,7 @@ TC_AcceptUdp(char *host, int port) { memcpy(&serv_addr.sin_addr.s_addr, ip_host->h_addr_list[0], sizeof(&serv_addr.sin_addr.s_addr)); } else { -#ifdef HAVE_HSTRERROR tlog(TL_CRIT,"gethostbyname: %s - %s", host, hstrerror(h_errno)); -#else - tlog(TL_CRIT,"gethostbyname: %s - %s", host, strerror(errno)); -#endif close(sockfd); return -1; } @@ -177,11 +173,7 @@ TC_sendMsg( Msg *msg ) { memcpy(&msg->host_addr.sin_addr.s_addr, ip_host->h_addr_list[0], sizeof(&msg->host_addr.sin_addr.s_addr)); } else { -#ifdef HAVE_HSTRERROR tlog(TL_CRIT,"gethostbyname: %s - %s", msg->host, hstrerror(h_errno)); -#else - tlog(TL_CRIT,"gethostbyname: %s - %s", msg->host, strerror(errno)); -#endif close(msg->sockfd); msg->sockfd=-1; return CS_ERROR; -- 2.37.3