[packages] liboping: update to v1.3.4 (#6462)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@19070 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2010-01-08 00:08:42 +00:00
parent 361f7232b3
commit 6283cd4817
2 changed files with 5 additions and 97 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2009 OpenWrt.org
# Copyright (C) 2009-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@ -8,14 +8,15 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=liboping
PKG_VERSION:=1.3.3
PKG_VERSION:=1.3.4
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://verplant.org/liboping/files
PKG_MD5SUM:=4ead44ef797dc557106fdc91aa61bd97
PKG_MD5SUM:=208e185f75f9f8ac96e508bd9e17ef61
PKG_FIXUP:=libtool
PKG_INSTALL:=1
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
@ -39,7 +40,6 @@ $(call Package/liboping/Default)
DEPENDS+= +liboping
endef
TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
@ -47,12 +47,6 @@ CONFIGURE_ARGS += \
--enable-shared \
--enable-static
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
DESTDIR="$(PKG_INSTALL_DIR)" \
all install
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(CP) $(PKG_INSTALL_DIR)/usr/include/oping.h $(1)/usr/include/
@ -67,7 +61,7 @@ endef
define Package/oping/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/oping $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/oping $(1)/usr/bin/
endef
$(eval $(call BuildPackage,liboping))

View File

@ -1,86 +0,0 @@
diff --git a/src/liboping.c b/src/liboping.c
index 411d866..e80ea29 100644
--- a/src/liboping.c
+++ b/src/liboping.c
@@ -590,9 +590,10 @@ static int ping_receive_one (pingobj_t *obj, const pinghost_t *ph,
static int ping_receive_all (pingobj_t *obj)
{
- fd_set readfds;
- int num_readfds;
- int max_readfds;
+ fd_set read_fds;
+ fd_set err_fds;
+ int num_fds;
+ int max_fd;
pinghost_t *ph;
pinghost_t *ptr;
@@ -631,23 +632,25 @@ static int ping_receive_all (pingobj_t *obj)
while (1)
{
- FD_ZERO (&readfds);
- num_readfds = 0;
- max_readfds = -1;
+ FD_ZERO (&read_fds);
+ FD_ZERO (&err_fds);
+ num_fds = 0;
+ max_fd = -1;
for (ptr = ph; ptr != NULL; ptr = ptr->next)
{
if (!timerisset (ptr->timer))
continue;
- FD_SET (ptr->fd, &readfds);
- num_readfds++;
+ FD_SET (ptr->fd, &read_fds);
+ FD_SET (ptr->fd, &err_fds);
+ num_fds++;
- if (max_readfds < ptr->fd)
- max_readfds = ptr->fd;
+ if (max_fd < ptr->fd)
+ max_fd = ptr->fd;
}
- if (num_readfds == 0)
+ if (num_fds == 0)
break;
if (gettimeofday (&nowtime, NULL) == -1)
@@ -659,11 +662,11 @@ static int ping_receive_all (pingobj_t *obj)
if (ping_timeval_sub (&endtime, &nowtime, &timeout) == -1)
break;
- dprintf ("Waiting on %i sockets for %i.%06i seconds\n", num_readfds,
+ dprintf ("Waiting on %i sockets for %i.%06i seconds\n", num_fds,
(int) timeout.tv_sec,
(int) timeout.tv_usec);
- status = select (max_readfds + 1, &readfds, NULL, NULL, &timeout);
+ status = select (max_fd + 1, &read_fds, NULL, &err_fds, &timeout);
if (gettimeofday (&nowtime, NULL) == -1)
{
@@ -696,9 +699,18 @@ static int ping_receive_all (pingobj_t *obj)
for (ptr = ph; ptr != NULL; ptr = ptr->next)
{
- if (FD_ISSET (ptr->fd, &readfds))
+ if (FD_ISSET (ptr->fd, &read_fds))
+ {
if (ping_receive_one (obj, ptr, &nowtime) == 0)
ret++;
+ }
+ else if (FD_ISSET (ptr->fd, &err_fds))
+ {
+ /* clear the timer in this case so that we
+ * don't run into an endless loop. */
+ /* TODO: Set an error flag in this case. */
+ timerclear (ptr->timer);
+ }
}
} /* while (1) */