From: Denis Ovsienko Date: Mon, 25 Mar 2024 15:02:50 +0000 (+0000) Subject: Disregard setlinebuf(3), always use setvbuf(3). X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/a9c7cf884805b0a3ebdefd574e5a061f31c5e3fb Disregard setlinebuf(3), always use setvbuf(3). 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. --- diff --git a/CHANGES b/CHANGES index d8200348..f856b64d 100644 --- 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. diff --git a/CMakeLists.txt b/CMakeLists.txt index a3c44b41..d38e4b3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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(). # diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index fc2dd137..52794e5d 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -162,9 +162,6 @@ /* Define to 1 if you have the 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 header file. */ #cmakedefine HAVE_STDINT_H 1 diff --git a/configure.ac b/configure.ac index 77ad065c..78c9b1be 100644 --- a/configure.ac +++ b/configure.ac @@ -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. diff --git a/tcpdump.c b/tcpdump.c index 28f68077..0e6fd3ba 100644 --- 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;