Merge pull request #1 from barak/master
authorFlorian Forster <github@nospam.verplant.org>
Sat, 27 Aug 2011 15:00:37 +0000 (08:00 -0700)
committerFlorian Forster <github@nospam.verplant.org>
Sat, 27 Aug 2011 15:00:37 +0000 (08:00 -0700)
upstream update + tweaks

.gitignore
ChangeLog
Makefile.am
configure.ac
src/Makefile.am
src/liboping.c
src/oping.c
src/oping.h

index 53ca1f5..8588514 100644 (file)
@@ -12,6 +12,7 @@ depcomp
 install-sh
 missing
 stamp-h1
+/m4/
 
 # libtool stuff
 libltdl
@@ -19,13 +20,14 @@ libtool
 ltmain.sh
 
 # build output
-.libs
+.libs/
 bindings/perl/Oping.c
 bindings/perl/blib
 bindings/perl/pm_to_blib
 src/mans/*.3
 src/mans/*.8
 src/oping
+src/noping
 *.bs
 *.la
 *.lo
index 831f3d4..e895bbe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-03-06, Version 1.6.1:
+       * Build system: If "make install" is executed as root, the CAP_NET_RAW
+         capability is added to the binary (on Linux) or the set-UID bit is
+         set (other Unixes).
+       * src/oping.c: Fix compiler warnings which may abort the build. Thanks
+         to James Bromberger for reporting the problem.
+       * noping: Compatibility with ncurses 5.8 has been fixed. Thanks to
+         Gaetan Bisson for his patch.
+
 2011-01-26, Version 1.6.0:
        * liboping: Improve timing of received network packets using
          SO_TIMESTAMP if available. Thanks to Bruno PrĂ©mont for his patch.
index af22243..6993205 100644 (file)
@@ -1,4 +1,3 @@
 SUBDIRS = src bindings
 
-dist-hook:
-       find $(distdir) -type d -name '.svn' | xargs rm -rf
+ACLOCAL_AMFLAGS = -I m4
index 854be48..43a7e9c 100644 (file)
@@ -1,8 +1,12 @@
-AC_INIT(liboping, 1.6.0)
-AC_CONFIG_SRCDIR(src/liboping.c)
-AC_CONFIG_HEADERS(src/config.h)
-AM_INIT_AUTOMAKE(dist-bzip2)
-AC_LANG(C)
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.68])
+AC_INIT([liboping],[1.6.1])
+AC_CONFIG_SRCDIR([src/liboping.c])
+AC_CONFIG_HEADERS([src/config.h])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([dist-bzip2])
+AC_LANG([C])
 
 AC_PREFIX_DEFAULT("/opt/oping")
 
@@ -16,7 +20,7 @@ AC_SUBST(LIBOPING_PATCH)
 
 # ABI version
 LIBOPING_CURRENT=2
-LIBOPING_REVISION=6
+LIBOPING_REVISION=7
 LIBOPING_AGE=2
 AC_SUBST(LIBOPING_CURRENT)
 AC_SUBST(LIBOPING_REVISION)
@@ -38,26 +42,13 @@ then
 fi
 AC_ARG_VAR(PERL, [Perl interpreter command])
 
-#
 # configure libtool
-#
-AC_LIBTOOL_DLOPEN
-AC_PROG_LIBTOOL
-#AC_PROG_RANLIB
+LT_INIT([dlopen])
 
-#
 # Checks for header files.
-#
 AC_HEADER_STDC
-AC_CHECK_HEADERS(unistd.h)
-AC_CHECK_HEADERS(math.h)
-AC_CHECK_HEADERS(fcntl.h)
-AC_CHECK_HEADERS(sys/types.h)
-AC_CHECK_HEADERS(sys/stat.h)
 AC_HEADER_TIME
-AC_CHECK_HEADERS(sys/socket.h)
-AC_CHECK_HEADERS(netdb.h)
-AC_CHECK_HEADERS(signal.h)
+AC_CHECK_HEADERS([math.h signal.h fcntl.h inttypes.h netdb.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
 
 # This sucks, but what can I do..?
 AC_CHECK_HEADERS(netinet/in_systm.h, [], [],
@@ -162,6 +153,14 @@ AC_CHECK_HEADERS(netinet/icmp6.h, [], [],
 #endif
 ])
 
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_TYPE_UID_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT8_T
+
 socket_needs_socket="no"
 AC_CHECK_FUNCS(socket, [],
        AC_CHECK_LIB(socket, socket,
@@ -232,4 +231,10 @@ AC_SUBST(PERL_BINDINGS_OPTIONS)
 
 AC_SUBST(BINDINGS)
 
-AC_OUTPUT(Makefile src/Makefile src/mans/Makefile bindings/Makefile)
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_FUNC_STRERROR_R
+AC_CHECK_FUNCS([gettimeofday memset modf select socket sqrt strcasecmp strdup strerror strncasecmp strtoul])
+
+AC_CONFIG_FILES([Makefile src/Makefile src/mans/Makefile bindings/Makefile])
+AC_OUTPUT
index bc35a78..1326783 100644 (file)
@@ -51,3 +51,16 @@ if BUILD_WITH_LIBRT
 noping_LDADD += -lrt
 endif
 endif # BUILD_WITH_LIBNCURSES
+
+install-exec-hook:
+       @if test "x0" = "x$$UID"; then \
+               if test "xLinux" = "x`uname -s`"; then \
+                       echo "Setting CAP_NET_RAW capability on binaries."; \
+                       setcap cap_net_raw=ep $(DESTDIR)$(bindir)/oping || true; \
+                       setcap cap_net_raw=ep $(DESTDIR)$(bindir)/noping || true; \
+               else \
+                       echo "Setting set-UID bit on binaries."; \
+                       chmod u+s $(DESTDIR)$(bindir)/oping || true; \
+                       chmod u+s $(DESTDIR)$(bindir)/noping || true; \
+               fi; \
+       fi
index 58b51d9..83ca9c2 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * Object oriented C module to send ICMP and ICMPv6 `echo's.
- * Copyright (C) 2006-2010  Florian octo Forster <octo at verplant.org>
+ * Copyright (C) 2006-2011  Florian octo Forster <ff at octo.it>
  *
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published by the
@@ -1429,7 +1429,7 @@ int ping_host_add (pingobj_t *obj, const char *host)
                        snprintf (errmsg, PING_ERRMSG_LEN, "Unknown `ai_family': %i", ai_ptr->ai_family);
                        errmsg[PING_ERRMSG_LEN - 1] = '\0';
 
-                       dprintf (errmsg);
+                       dprintf ("%s", errmsg);
                        ping_set_error (obj, "getaddrinfo", errmsg);
                        continue;
                }
index 7058ac0..79d7569 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * Object oriented C module to send ICMP and ICMPv6 `echo's.
- * Copyright (C) 2006-2010  Florian octo Forster <ff at octo.it>
+ * Copyright (C) 2006-2011  Florian octo Forster <ff at octo.it>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -273,6 +273,7 @@ static void usage_exit (const char *name, int status) /* {{{ */
        exit (status);
 } /* }}} void usage_exit */
 
+__attribute__((noreturn))
 static void usage_qos_exit (const char *arg, int status) /* {{{ */
 {
        if (arg != 0)
@@ -334,8 +335,8 @@ static int set_opt_send_qos (const char *opt) /* {{{ */
                        && (strlen (opt) == 4))
        {
                uint8_t dscp;
-               uint8_t class;
-               uint8_t prec;
+               uint8_t class = 0;
+               uint8_t prec = 0;
 
                /* There are four classes, AF1x, AF2x, AF3x, and AF4x. */
                if (opt[2] == '1')
@@ -672,7 +673,7 @@ static int on_resize (pingobj_t *ping) /* {{{ */
                        context->window = NULL;
                }
                context->window = newwin (/* height = */ 4,
-                               /* width = */ 0,
+                               /* width = */ width,
                                /* y = */ main_win_height + (4 * context->index),
                                /* x = */ 0);
        }
@@ -725,7 +726,7 @@ static int pre_loop_hook (pingobj_t *ping) /* {{{ */
 
        main_win_height = height - (4 * host_num);
        main_win = newwin (/* height = */ main_win_height,
-                       /* width = */ 0,
+                       /* width = */ width,
                        /* y = */ 0, /* x = */ 0);
        /* Allow scrolling */
        scrollok (main_win, TRUE);
@@ -751,7 +752,7 @@ static int pre_loop_hook (pingobj_t *ping) /* {{{ */
                        context->window = NULL;
                }
                context->window = newwin (/* height = */ 4,
-                               /* width = */ 0,
+                               /* width = */ width,
                                /* y = */ main_win_height + (4 * context->index),
                                /* x = */ 0);
        }
index abeb544..e53d139 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * Object oriented C module to send ICMP and ICMPv6 `echo's.
- * Copyright (C) 2006-2010  Florian octo Forster <ff at octo.it>
+ * Copyright (C) 2006-2011  Florian octo Forster <ff at octo.it>
  *
  * This library is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published by the
@@ -33,7 +33,7 @@
 extern "C" {
 #endif
 
-#define OPING_VERSION 1006000
+#define OPING_VERSION 1006001
 
 /*
  * Type definitions