]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Stick with one version of pcap_dump_ftell.c.
authorDenis Ovsienko <[email protected]>
Sat, 28 Jul 2018 12:36:17 +0000 (13:36 +0100)
committerDenis Ovsienko <[email protected]>
Sat, 28 Jul 2018 12:36:17 +0000 (13:36 +0100)
It looks like CMake after commit 3e9e2b6 started to use the newly added
missing/pcap_dump_ftell.c to make pcap_dump_ftell() available in tcpdump
if libpcap does not have it. However, autotools continued to use the
previously existing ./pcap_dump_ftell.c for the same purpose. Remove the
previously existing file and amend autotools files to cover
pcap_dump_ftell() the same way as the other functions in the missing/
directory files.

Amend missing/pcap_dump_ftell.c not to use pcap_dump_file(), as it may be
unavailable.

This has been tested to work with libpcap 0.6.1.

INSTALL.txt
Makefile.in
config.h.in
configure
configure.ac
missing/pcap_dump_ftell.c
pcap_dump_ftell.c [deleted file]

index aea35d6feae81cc1347b9f645e5607fcbf241fad..d711e877f731481f940627d6f78061e9f039ad7a 100644 (file)
@@ -98,8 +98,6 @@ nlpid.h               - OSI NLPID definitions
 ospf.h         - Open Shortest Path First definitions
 packetdat.awk  - TCP chunk summary awk script
 parsenfsfh.c   - Network File System file parser routines
-pcap_dump_ftell.c - pcap_dump_ftell() implementation, in case libpcap
-               doesn't have it
 pcap-missing.h - declarations of functions possibly missing from libpcap
 ppp.h          - Point to Point Protocol definitions
 print.c                - Top-level routines for protocol printing
index f32a11d1a60681eb2ecd7c8ba8aa80f688833310..d53735b01f58b88845029f177f2a51e4e68571bf 100644 (file)
@@ -363,7 +363,6 @@ EXTRA_DIST = \
        missing/win_ether_ntohost.h \
        mkdep \
        packetdat.awk \
-       pcap_dump_ftell.c \
        print-pflog.c \
        print-smb.c \
        send-ack.awk \
@@ -407,6 +406,8 @@ strlcpy.o: $(srcdir)/missing/strlcpy.c
        $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
 strsep.o: $(srcdir)/missing/strsep.c
        $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strsep.c
+pcap_dump_ftell.o: $(srcdir)/missing/pcap_dump_ftell.c
+       $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/pcap_dump_ftell.c
 
 install: all
        [ -d $(DESTDIR)$(sbindir) ] || \
index 8ae16730ffb65716c0b0ae4caa128f66d08d06bd..f032227a2e8a016763df454c432fcfdbc9d4d545 100644 (file)
 /* Define to 1 if you have the `pcap_dump_flush' function. */
 #undef HAVE_PCAP_DUMP_FLUSH
 
-/* define if libpcap has pcap_dump_ftell() */
+/* Define to 1 if you have the `pcap_dump_ftell' function. */
 #undef HAVE_PCAP_DUMP_FTELL
 
 /* Define to 1 if you have the `pcap_dump_ftell64' function. */
index f64c4eea51abd54f83fce537315c33e37dbb64a7..07febdef7bc7bf8b17c90968cae6c62424aa77b4 100755 (executable)
--- a/configure
+++ b/configure
@@ -5126,6 +5126,19 @@ esac
 
 fi
 
+ac_fn_c_check_func "$LINENO" "pcap_dump_ftell" "ac_cv_func_pcap_dump_ftell"
+if test "x$ac_cv_func_pcap_dump_ftell" = xyes; then :
+  $as_echo "#define HAVE_PCAP_DUMP_FTELL 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" pcap_dump_ftell.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS pcap_dump_ftell.$ac_objext"
+ ;;
+esac
+
+fi
+
 
 for ac_func in fork vfork strftime
 do :
@@ -6064,23 +6077,6 @@ fi
 done
 
 
-ac_fn_c_check_func "$LINENO" "pcap_dump_ftell" "ac_cv_func_pcap_dump_ftell"
-if test "x$ac_cv_func_pcap_dump_ftell" = xyes; then :
-
-$as_echo "#define HAVE_PCAP_DUMP_FTELL 1" >>confdefs.h
-
-else
-
-           case " $LIBOBJS " in
-  *" pcap_dump_ftell.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS pcap_dump_ftell.$ac_objext"
- ;;
-esac
-
-
-fi
-
-
 #
 # Do we have the new open API?  Check for pcap_create, and assume that,
 # if we do, we also have pcap_activate() and the other new routines
index 46f841c0349e9d0d2d5b71e6c1f70fc83593ccb0..5a253743d6ea4a3f1c6ca69ab5a046bf5f83d501 100644 (file)
@@ -409,7 +409,7 @@ AC_INCLUDES_DEFAULT
        fi
 ])
 
-AC_REPLACE_FUNCS(strlcat strlcpy strdup strsep getservent getopt_long)
+AC_REPLACE_FUNCS(strlcat strlcpy strdup strsep getservent getopt_long pcap_dump_ftell)
 AC_CHECK_FUNCS(fork vfork strftime)
 AC_CHECK_FUNCS(setlinebuf)
 
@@ -672,17 +672,6 @@ dnl so just define the HAVE_ value if it's there.
 dnl
 AC_CHECK_FUNCS(pcap_breakloop)
 
-dnl
-dnl Check for "pcap_dump_ftell()" and use a substitute version
-dnl if it's not present.
-dnl
-AC_CHECK_FUNC(pcap_dump_ftell,
-       AC_DEFINE(HAVE_PCAP_DUMP_FTELL, 1,
-           [define if libpcap has pcap_dump_ftell()]),
-       [
-           AC_LIBOBJ(pcap_dump_ftell)
-       ])
-
 #
 # Do we have the new open API?  Check for pcap_create, and assume that,
 # if we do, we also have pcap_activate() and the other new routines
index b91fc125ec4fea314b4c1f2993e9850a40d924cd..ddc516672e85445173d8b088499f254a56cdb53e 100644 (file)
@@ -38,5 +38,9 @@
 long
 pcap_dump_ftell(pcap_dumper_t *p)
 {
-       return (ftell(pcap_dump_file(p)));
+       /* FIXME: Using pcap_dump_file(p) would be a better style. That would
+        * require to test if pcap_dump_file() is available, and to substitute it,
+        * if it is not.
+        */
+       return (ftell((FILE *)p));
 }
diff --git a/pcap_dump_ftell.c b/pcap_dump_ftell.c
deleted file mode 100644 (file)
index 1b652b5..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 1993, 1994, 1995, 1996, 1997
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that: (1) source code distributions
- * retain the above copyright notice and this paragraph in its entirety, (2)
- * distributions including binary code include the above copyright notice and
- * this paragraph in its entirety in the documentation or other materials
- * provided with the distribution, and (3) all advertising materials mentioning
- * features or use of this software display the following acknowledgement:
- * ``This product includes software developed by the University of California,
- * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
- * the University nor the names of its contributors may be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include <stdio.h>
-#include <pcap.h>
-
-#include "pcap-missing.h"
-
-long
-pcap_dump_ftell(pcap_dumper_t *p)
-{
-       return (ftell((FILE *)p));
-}