From e103487ade654c8cb2bd20fcaadf97ee98faa737 Mon Sep 17 00:00:00 2001 From: venaas Date: Fri, 4 May 2007 14:46:49 +0000 Subject: added logging to file and syslog (need to add support for specifying facility) git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@72 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- util.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 77fa004..4dabf47 100644 --- a/util.c +++ b/util.c @@ -13,10 +13,11 @@ #include #include #include -#include #include #include "debug.h" +#if 0 +#include void errx(char *format, ...) { extern int errno; @@ -47,6 +48,7 @@ void err(char *format, ...) { } else fprintf(stderr, "\n"); } +#endif char *stringcopy(char *s, int len) { char *r; @@ -78,7 +80,7 @@ char *addr2string(struct sockaddr *addr, socklen_t len) { } if (getnameinfo(addr, len, addr_buf[i], sizeof(addr_buf[i]), NULL, 0, NI_NUMERICHOST)) { - err("getnameinfo"); + debug(DBG_WARN, "getnameinfo failed"); return NULL; } return addr_buf[i]; @@ -93,19 +95,19 @@ int connectport(int type, char *host, char *port) { hints.ai_family = AF_UNSPEC; if (getaddrinfo(host, port, &hints, &res0) != 0) { - err("connectport: can't resolve host %s port %s", host, port); + debug(DBG_ERR, "connectport: can't resolve host %s port %s", host, port); return -1; } for (res = res0; res; res = res->ai_next) { s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (s < 0) { - err("connectport: socket failed"); + debug(DBG_WARN, "connectport: socket failed"); continue; } if (connect(s, res->ai_addr, res->ai_addrlen) == 0) break; - err("connectport: connect failed"); + debug(DBG_WARN, "connectport: connect failed"); close(s); s = -1; } -- cgit v1.2.3