summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 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:
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);