summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-01-04 10:19:31 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-01-04 10:19:31 +0100
commit10713de6bf9f0c2d9ade248546e63617a9ef9780 (patch)
tree9a796eb5db17ea5f6197c03eb362499d6e1e5b5a
parent26bffbb6a4036a1a1bc3bca99ad9dad66f0618d7 (diff)
parenta325ff7e6f142b7bcb4cc74959ab4e55e9ff0cb9 (diff)
Merge branch 'master' of https://git.oftal.dk/debug
-rw-r--r--debug_syslog.c5
-rw-r--r--main_syslog.c2
2 files changed, 5 insertions, 2 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:
diff --git a/main_syslog.c b/main_syslog.c
index 123f8ed..810669e 100644
--- a/main_syslog.c
+++ b/main_syslog.c
@@ -36,7 +36,7 @@
int main(int argc, char *argv[])
{
dbg_status_t status = dbg_init(DBG_FLAG_OUTPUT_TO_SYSLOG,
- DBG_OPTION_SYSLOG_HOST, "127.0.0.1",
+ DBG_OPTION_SYSLOG_HOST, "localhost",
DBG_OPTION_SYSLOG_PORT, 514,
DBG_OPTION_END);