summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5a62973)
raw | patch | inline | side by side (parent: 5a62973)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 9 Jul 2006 10:16:02 +0000 (12:16 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 9 Jul 2006 10:16:02 +0000 (12:16 +0200) |
src/ping.c | patch | blob | history |
diff --git a/src/ping.c b/src/ping.c
index 91e0dbcc01072fd7601695349f08684adcd53523..8e2c50b43b73880fff4bae121135bb4489e8681a 100644 (file)
--- a/src/ping.c
+++ b/src/ping.c
#define MODULE_NAME "ping"
#include <netinet/in.h>
-#include "liboping/liboping.h"
+#include "liboping/oping.h"
static pingobj_t *pingobj = NULL;
{
pingobj_iter_t *iter;
- char *host;
- double latency;
+ char host[512];
+ double latency;
+ size_t buf_len;
if (pingobj == NULL)
return;
return;
}
- for (iter = ping_iterator_get (pingobj); iter != NULL; iter = ping_iterator_next (iter))
+ for (iter = ping_iterator_get (pingobj);
+ iter != NULL;
+ iter = ping_iterator_next (iter))
{
- const char *tmp;
-
- if ((tmp = ping_iterator_get_host (iter)) == NULL)
- continue;
- if ((host = strdup (tmp)) == NULL)
+ buf_len = sizeof (host);
+ if (ping_iterator_get_info (iter, PING_INFO_HOSTNAME,
+ host, &buf_len))
continue;
- latency = ping_iterator_get_latency (iter);
+ buf_len = sizeof (latency);
+ if (ping_iterator_get_info (iter, PING_INFO_LATENCY,
+ &latency, &buf_len))
+ continue;
DBG ("host = %s, latency = %f", host, latency);
ping_submit (host, latency);
-
- free (host); host = NULL;
}
}