Correct use HAVE_HSTRERROR
authorteodor <teodor>
Mon, 3 Dec 2007 15:15:28 +0000 (15:15 +0000)
committerteodor <teodor>
Mon, 3 Dec 2007 15:15:28 +0000 (15:15 +0000)
connection.h
tcp.c
udp.c

index 572e357..9aba67f 100644 (file)
@@ -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 (file)
--- 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 (file)
--- 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;