Merge branch 'pull/liboping-0.3' into liboping-0.3
authorFlorian Forster <octo@verplant.org>
Sat, 26 Jan 2008 12:59:07 +0000 (13:59 +0100)
committerFlorian Forster <octo@verplant.org>
Sat, 26 Jan 2008 12:59:07 +0000 (13:59 +0100)
ChangeLog
configure.ac
debian/changelog
src/liboping.c
src/mans/ping_iterator_get.pod
src/oping.h

index f5eea37..8adff04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-03-27, Version 0.3.5
+       * liboping.c: Close the filedescriptor in `ping_free', not
+         `ping_host_remove'. Thanks to Esteban Sanchez for submitting this
+         patch.
+       * oping.h: Include <sys/types.h> so that `size_t' is defined. Thanks
+         to Alex Brooks for pointing this out.
+       * oping.h: Use `extern "C"' when being used with C++. Thanks to Alex
+         Brooks for pointing this out.
+
 2006-12-01, Version 0.3.4
        * Fixes a bug in `ping_host_remove': Due to an incorrect hostname
          checking the wrong host would be removed.
index 2c4eada..85c2b9e 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT(liboping, 0.3.4)
+AC_INIT(liboping, 0.3.5)
 AC_CONFIG_SRCDIR(src/liboping.c)
 AC_CONFIG_HEADERS(src/config.h)
 AM_INIT_AUTOMAKE(dist-bzip2)
index 2ea7af9..94f67f5 100644 (file)
@@ -1,3 +1,9 @@
+liboping (0.3.5-0octo1) unstable; urgency=low
+
+  * New upstream version.
+
+ -- Florian Forster <octo@leeloo.home.verplant.org>  Tue, 27 Mar 2007 11:20:33 +0200
+
 liboping (0.3.4-0octo1) unstable; urgency=low
 
   * New upstream version.
index 62bc461..4c614f7 100644 (file)
@@ -288,6 +288,22 @@ static pinghost_t *ping_receive_ipv4 (pinghost_t *ph, char *buffer, size_t buffe
        return (ptr);
 }
 
+#ifndef ICMP6_ECHO_REQUEST
+# ifdef ICMP6_ECHO /* AIX netinet/ip6_icmp.h */
+#  define ICMP6_ECHO_REQUEST ICMP6_ECHO
+# else
+#  define ICMP6_ECHO_REQUEST 128
+# endif
+#endif
+
+#ifndef ICMP6_ECHO_REPLY
+# ifdef ICMP6_ECHOREPLY /* AIX netinet/ip6_icmp.h */
+#  define ICMP6_ECHO_REPLY ICMP6_ECHOREPLY
+# else
+#  define ICMP6_ECHO_REPLY 129
+# endif
+#endif
+
 static pinghost_t *ping_receive_ipv6 (pinghost_t *ph, char *buffer, size_t buffer_len)
 {
        struct icmp6_hdr *icmp_hdr;
@@ -778,6 +794,7 @@ static pinghost_t *ping_alloc (void)
        ph->addr    = (struct sockaddr_storage *) (ph->timer + 1);
 
        ph->addrlen = sizeof (struct sockaddr_storage);
+       ph->fd      = -1;
        ph->latency = -1.0;
        ph->ident   = ping_get_ident () & 0xFFFF;
 
@@ -786,6 +803,9 @@ static pinghost_t *ping_alloc (void)
 
 static void ping_free (pinghost_t *ph)
 {
+       if (ph->fd >= 0)
+               close (ph->fd);
+       
        if (ph->hostname != NULL)
                free (ph->hostname);
 
@@ -1152,8 +1172,7 @@ int ping_host_add (pingobj_t *obj, const char *host)
 
        if (ph->fd < 0)
        {
-               free (ph->hostname);
-               free (ph);
+               ping_free (ph);
                return (-1);
        }
 
@@ -1210,9 +1229,6 @@ int ping_host_remove (pingobj_t *obj, const char *host)
        else
                pre->next = cur->next;
        
-       if (cur->fd >= 0)
-               close (cur->fd);
-
        ping_free (cur);
 
        return (0);
index ae73539..b9361b2 100644 (file)
@@ -43,3 +43,8 @@ L<ping_iterator_get_context(3)>,
 L<liboping(3)>
 
 =head1 AUTHOR
+
+liboping is written by Florian octo Forster E<lt>octo at verplant.orgE<gt>.
+It's homepage can be found at L<http://verplant.org/liboping/>.
+
+(c) 2005, 2006 by Florian octo Forster.
index 061aa5d..b17e659 100644 (file)
 #if HAVE_UNISTD_H
 # include <unistd.h>
 #endif
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
 #if HAVE_SYS_SOCKET_H
 # include <sys/socket.h>
 #endif
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * Type definitions
  */
@@ -87,4 +94,8 @@ const char *ping_get_error (pingobj_t *obj);
 void *ping_iterator_get_context (pingobj_iter_t *iter);
 void  ping_iterator_set_context (pingobj_iter_t *iter, void *context);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* OCTO_PING_H */