]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Disregard setlinebuf(3), always use setvbuf(3). 1152/head
authorDenis Ovsienko <[email protected]>
Mon, 25 Mar 2024 15:02:50 +0000 (15:02 +0000)
committerDenis Ovsienko <[email protected]>
Mon, 25 Mar 2024 15:09:00 +0000 (15:09 +0000)
As most setlinebuf(3) man pages mention, setlinebuf() is a shorthand for
setvbuf().  The latter is in C99, but the former is not, so it is most
logical to use setvbuf() in all cases and to lose another build-time
check.

CHANGES
CMakeLists.txt
cmakeconfig.h.in
configure.ac
tcpdump.c

diff --git a/CHANGES b/CHANGES
index d82003481e7d65d97d2f6919209859fa19121a39..f856b64dfe9fb30fee37b7323c4e7693e28cc96f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -42,6 +42,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
       IEEE 802.11: Simplify handle_action().
       Provide GET_ macros for 4-byte and 8-byte floating-point numbers
         and use them rather than custom code
+      Disregard setlinebuf(3), always use setvbuf(3).
     Building and testing:
       autoconf: Update install-sh script to the latest available version.
       autoconf: Remove detection of early IPv6 stacks.
index a3c44b411f1cbbca5000aa454632a9d8f59a4c31..d38e4b3bea2d5056c12b044cbdc165af3abf764b 100644 (file)
@@ -485,7 +485,6 @@ tcpdump would not work correctly even if it managed to compile."
 endif()
 
 check_function_exists(getopt_long HAVE_GETOPT_LONG)
-check_function_exists(setlinebuf HAVE_SETLINEBUF)
 #
 # For Windows,  don't need to waste time checking for fork() or vfork().
 #
index fc2dd137cbf178d34e09003c8185e0ba097c26c5..52794e5db9916ca8358e0fc64fad6c87b57088b2 100644 (file)
 /* Define to 1 if you have the <rpc/rpc.h> header file. */
 #cmakedefine HAVE_RPC_RPC_H 1
 
-/* Define to 1 if you have the `setlinebuf' function. */
-#cmakedefine HAVE_SETLINEBUF 1
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #cmakedefine HAVE_STDINT_H 1
 
index 77ad065c00d0f6a7f4b1ddb3fa097b6a17c3ce6a..78c9b1bedc2a30ff51aabadd01c26d2e9e3f25d2 100644 (file)
@@ -283,7 +283,6 @@ AC_LBL_LIBRARY_NET
 
 AC_REPLACE_FUNCS(strlcat strlcpy strsep getservent getopt_long)
 AC_CHECK_FUNCS(fork vfork)
-AC_CHECK_FUNCS(setlinebuf)
 
 #
 # Make sure we have snprintf(); we require it.
index 28f68077baeec6a26534aad8e3340a2e6c8c2995..0e6fd3bac7a941d4e08ebe21edc1857743129855 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -1781,11 +1781,7 @@ main(int argc, char **argv)
                         */
                        setvbuf(stdout, NULL, _IONBF, 0);
 #else /* _WIN32 */
-#ifdef HAVE_SETLINEBUF
-                       setlinebuf(stdout);
-#else
                        setvbuf(stdout, NULL, _IOLBF, 0);
-#endif
 #endif /* _WIN32 */
                        lflag = 1;
                        break;