summaryrefslogtreecommitdiff
path: root/debug_syslog.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug_syslog.c')
-rw-r--r--debug_syslog.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/debug_syslog.c b/debug_syslog.c
index 2644246..9a2afbd 100644
--- a/debug_syslog.c
+++ b/debug_syslog.c
@@ -33,6 +33,7 @@
#include <sys/socket.h>
#include <arpa/inet.h>
+#include <netdb.h>
#include <unistd.h>
#include <netinet/in.h>
#include <errno.h>
@@ -66,7 +67,9 @@ void dbg_syslog_init(const char* host, int port)
}
memset(&dbg_syslog_sockaddr, 0, sizeof(dbg_syslog_sockaddr));
dbg_syslog_sockaddr.sin_family = AF_INET;
- dbg_syslog_sockaddr.sin_addr.s_addr = inet_addr(host);
+// dbg_syslog_sockaddr.sin_addr.s_addr = inet_addr(host);
+ struct hostent *hp = gethostbyname(host);
+ memcpy(&(dbg_syslog_sockaddr.sin_addr),*(hp->h_addr_list),sizeof(struct in_addr));
dbg_syslog_sockaddr.sin_port = htons(port);
// This implementation has all kind of possible errors: