summaryrefslogtreecommitdiff
path: root/debug_syslog.c
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2012-12-13 14:09:01 +0100
committerJonas Suhr Christensen <jsc@umbraculum.org>2012-12-13 14:09:01 +0100
commita325ff7e6f142b7bcb4cc74959ab4e55e9ff0cb9 (patch)
treeaadb87af4860f16212b88a73662db588217e35da /debug_syslog.c
parentc0a0deec86c79d276bc4443fd0f6aef7b6b12f9f (diff)
Added support for dns in syslog module.
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 5ed82a9..595304e 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>
@@ -64,7 +65,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: