]> The Tcpdump Group git mirrors - libpcap/commitdiff
Remove some workarounds for old compilers.
authorGuy Harris <[email protected]>
Fri, 9 Aug 2019 21:49:08 +0000 (14:49 -0700)
committerGuy Harris <[email protected]>
Fri, 9 Aug 2019 21:49:08 +0000 (14:49 -0700)
Require Visual Studio 2015 or later; fail if we don't have it, and
remove checks for older versions.

That means we have C99-compliant snprintf() and vsnprintf(); require
them when configuring for UN*X, and then use them directly, rather than
having wrappers for systems lacking them.

If we're using MSVC, skip the tests for options to request C99
compatibility - either we have VS 2015, which is sufficient, or we
don't, in which case we fail.

53 files changed:
CMakeLists.txt
Makefile.in
bpf_image.c
config.h.in
configure
configure.ac
dlpisubs.c
fad-gifc.c
fmtutils.c
gencode.c
lbl/os-osf4.h
lbl/os-osf5.h
lbl/os-solaris2.h
lbl/os-sunos4.h
missing/snprintf.c [deleted file]
missing/win_asprintf.c
missing/win_snprintf.c [deleted file]
optimize.c
pcap-bpf.c
pcap-bt-linux.c
pcap-bt-monitor-linux.c
pcap-dag.c
pcap-dbus.c
pcap-dlpi.c
pcap-dos.c
pcap-dpdk.c
pcap-libdlpi.c
pcap-linux.c
pcap-netfilter-linux.c
pcap-new.c
pcap-nit.c
pcap-npf.c
pcap-pf.c
pcap-rdmasniff.c
pcap-rpcap.c
pcap-septel.c
pcap-sita.c
pcap-snf.c
pcap-snoop.c
pcap-tc.c
pcap-usb-linux.c
pcap.c
pcap/funcattrs.h
pcap/pcap-inttypes.h
portability.h
rpcapd/daemon.c
rpcapd/log.c
rpcapd/rpcapd.c
savefile.c
sf-pcap.c
sf-pcapng.c
sockutils.c
sslutils.c

index f4d93d0d5fea9efc4afff44be84b039a1ce158c0..8863eaf812d41cdbd15d5c899ec1c8ff60325178 100644 (file)
@@ -21,37 +21,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
 project(pcap)
 
 #
-# Try to enable as many C99 features as we can.
-# At minimum, we want C++/C99-style // comments.
-#
-# Newer versions of compilers might default to supporting C99, but older
-# versions may require a special flag.
-#
-# Prior to CMake 3.1, setting CMAKE_C_STANDARD will not have any effect,
-# so, unless and until we require CMake 3.1 or later, we have to do it
-# ourselves on pre-3.1 CMake, so we just do it ourselves on all versions
-# of CMake.
-#
-# Note: with CMake 3.1 through 3.5, the only compilers for which CMake
-# handles CMAKE_C_STANDARD are GCC and Clang.  3.6 adds support only
-# for Intel C; 3.9 adds support for PGI C, Sun C, and IBM XL C, and
-# 3.10 adds support for Cray C and IAR C, but no version of CMake has
-# support for HP C.  Therefore, even if we use CMAKE_C_STANDARD with
-# compilers for which CMake supports it, we may still have to do it
-# ourselves on other compilers.
-#
-# See the CMake documentation for the CMAKE_<LANG>_COMPILER_ID variables
-# for a list of compiler IDs.
-#
-# We don't worry about MSVC; it doesn't have such a flag - either it
-# doesn't support the C99 features we need at all, or it supports them
-# regardless of the compiler flag.
-#
-# XXX - this just tests whether the option works and adds it if it does.
-# We don't test whether it's necessary in order to get the C99 features
-# that we use; if we ever have a user who tries to compile with a compiler
-# that can't be made to support those features, we can add a test to make
-# sure we actually *have* C99 support.
+# For checking if a compiler flag works and adding it if it does.
 #
 include(CheckCCompilerFlag)
 macro(check_and_add_compiler_option _option)
@@ -64,31 +34,75 @@ macro(check_and_add_compiler_option _option)
     endif()
 endmacro()
 
-set(C_ADDITIONAL_FLAGS "")
-if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR
-   CMAKE_C_COMPILER_ID MATCHES "Clang")
-    check_and_add_compiler_option("-std=gnu99")
-elseif(CMAKE_C_COMPILER_ID MATCHES "XL")
-    #
-    # We want support for extensions picked up for GNU C compatibility,
-    # so we use -qlanglvl=extc99.
-    #
-    check_and_add_compiler_option("-qlanglvl=extc99")
-elseif(CMAKE_C_COMPILER_ID MATCHES "HP")
-    check_and_add_compiler_option("-AC99")
-elseif(CMAKE_C_COMPILER_ID MATCHES "Sun")
-    check_and_add_compiler_option("-xc99")
-elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
-    check_and_add_compiler_option("-c99")
-endif()
-
 #
-# Treat source files as being in UTF-8 with MSVC.
-# We assume that UTF-8 source is OK with other compilers.
+# If we're building with Visual Studio, we require Visual Studio 2015,
+# in order to get sufficient C99 compatibility.  Check for that.
 #
-if(MSVC AND NOT ${CMAKE_C_COMPILER} MATCHES "clang*")
-    set(C_ADDITIONAL_FLAGS "${C_ADDITIONAL_FLAGS} /utf-8")
-endif(MSVC AND NOT ${CMAKE_C_COMPILER} MATCHES "clang*")
+# If not, try the appropriate flag for the compiler to enable C99
+# features.
+#
+set(C_ADDITIONAL_FLAGS "")
+if(MSVC)
+    if(MSVC_VERSION LESS 1900)
+        message(FATAL_ERROR "Visual Studio 2015 or later is required")
+    endif()
+
+    # 
+    # Treat source files as being in UTF-8 with MSVC if it's not using
+    # the Clang front end.
+    # We assume that UTF-8 source is OK with other compilers and with
+    # MSVC if it's using the Clang front end.
+    # 
+    if(NOT ${CMAKE_C_COMPILER} MATCHES "clang*")
+        set(C_ADDITIONAL_FLAGS "${C_ADDITIONAL_FLAGS} /utf-8")
+    endif(NOT ${CMAKE_C_COMPILER} MATCHES "clang*")
+else(MSVC)
+    #
+    # Try to enable as many C99 features as we can.
+    # At minimum, we want C++/C99-style // comments.
+    #
+    # Newer versions of compilers might default to supporting C99, but
+    # older versions may require a special flag.
+    #
+    # Prior to CMake 3.1, setting CMAKE_C_STANDARD will not have any effect,
+    # so, unless and until we require CMake 3.1 or later, we have to do it
+    # ourselves on pre-3.1 CMake, so we just do it ourselves on all versions
+    # of CMake.
+    #
+    # Note: with CMake 3.1 through 3.5, the only compilers for which CMake
+    # handles CMAKE_C_STANDARD are GCC and Clang.  3.6 adds support only
+    # for Intel C; 3.9 adds support for PGI C, Sun C, and IBM XL C, and
+    # 3.10 adds support for Cray C and IAR C, but no version of CMake has
+    # support for HP C.  Therefore, even if we use CMAKE_C_STANDARD with
+    # compilers for which CMake supports it, we may still have to do it
+    # ourselves on other compilers.
+    #
+    # See the CMake documentation for the CMAKE_<LANG>_COMPILER_ID variables
+    # for a list of compiler IDs.
+    #
+    # XXX - this just tests whether the option works and adds it if it does.
+    # We don't test whether it's necessary in order to get the C99 features
+    # that we use; if we ever have a user who tries to compile with a compiler
+    # that can't be made to support those features, we can add a test to make
+    # sure we actually *have* C99 support.
+    #
+    if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR
+       CMAKE_C_COMPILER_ID MATCHES "Clang")
+        check_and_add_compiler_option("-std=gnu99")
+    elseif(CMAKE_C_COMPILER_ID MATCHES "XL")
+        #
+        # We want support for extensions picked up for GNU C compatibility,
+        # so we use -qlanglvl=extc99.
+        #
+        check_and_add_compiler_option("-qlanglvl=extc99")
+    elseif(CMAKE_C_COMPILER_ID MATCHES "HP")
+        check_and_add_compiler_option("-AC99")
+    elseif(CMAKE_C_COMPILER_ID MATCHES "Sun")
+        check_and_add_compiler_option("-xc99")
+    elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
+        check_and_add_compiler_option("-c99")
+    endif()
+endif(MSVC)
 
 #
 # Build all runtimes in the top-level binary directory; that way,
@@ -380,10 +394,24 @@ else(HAVE_STRERROR_R)
     #
     check_function_exists(strerror_s HAVE_STRERROR_S)
 endif(HAVE_STRERROR_R)
+
+#
+# Make sure we have vsnprintf() and snprintf(); we require them.
+# We use check_symbol_exists(), as they aren't necessarily external
+# functions - in Visual Studio, for example, they're inline functions
+# calling a common external function.
+#
+check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF)
+if(NOT HAVE_VSNPRINTF)
+    message(FATAL_ERROR "vsnprintf() is required but wasn't found")
+endif(NOT HAVE_VSNPRINTF)
+check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
+if(NOT HAVE_SNPRINTF)
+    message(FATAL_ERROR "snprintf() is required but wasn't found")
+endif()
+
 check_function_exists(strlcpy HAVE_STRLCPY)
 check_function_exists(strlcat HAVE_STRLCAT)
-check_function_exists(snprintf HAVE_SNPRINTF)
-check_function_exists(vsnprintf HAVE_VSNPRINTF)
 check_function_exists(asprintf HAVE_ASPRINTF)
 check_function_exists(vasprintf HAVE_VASPRINTF)
 check_function_exists(strtok_r HAVE_STRTOK_R)
@@ -962,52 +990,13 @@ set(PROJECT_SOURCE_LIST_C
 
 if(WIN32)
     #
-    # For now, we assume we don't have snprintf() or that it's not one
-    # that behaves enough like C99's snprintf() for our purposes (i.e.,
-    # it doesn't null-terminate the string if it truncates it to fit in
-    # the buffer), so we have to provide our own (a wrapper around
-    # _snprintf() that null-terminates the buffer).
-    #
-    # We also assume we don't have asprintf(), and provide an implementation
+    # We assume we don't have asprintf(), and provide an implementation
     # that uses _vscprintf() to determine how big the string needs to be.
     #
     set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C}
-        missing/win_snprintf.c missing/win_asprintf.c)
+        missing/win_asprintf.c)
 else()
-    #
-    # Either:
-    #
-    #  we have snprintf() and vsnprintf(), and have asprintf() and
-    #  vasprintf();
-    #
-    #  we have snprintf() and vsnprintf(), but don't have asprintf()
-    #  or vasprintf();
-    #
-    #  we have neither snprintf() nor vsnprintf(), and don't have
-    #  asprintf() or vasprintf(), either.
-    #
-    # We assume that if we have asprintf() we have vasprintf(), as well
-    # as snprintf() and vsnprintf(), and that if we have snprintf() we
-    # have vsnprintf().
-    #
-    # For the first case, we don't need any replacement routines.
-    # For the second case, we need replacement asprintf()/vasprintf()
-    # routines.
-    # For the third case, we need replacement snprintf()/vsnprintf() and
-    # asprintf()/vasprintf() routines.
-    #
-    if(NOT HAVE_SNPRINTF)
-        #
-        # We assume we have none of them; missing/snprintf.c supplies
-        # all of them.
-        #
-        set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C} missing/snprintf.c)
-    elif(NOT HAVE_ASPRINTF)
-        #
-        # We assume we have snprintf()/vsnprintf() but lack
-        # asprintf()/vasprintf(); missing/asprintf.c supplies
-        # the latter (using vsnprintf()).
-        #
+    if(NOT HAVE_ASPRINTF)
         set(PROJECT_SOURCE_LIST_C ${PROJECT_SOURCE_LIST_C} missing/asprintf.c)
     endif()
     if(NOT HAVE_STRLCAT)
index e8cb4fede4ae2c1228315bf2cadf0a5c5a232b7b..956d99bf07fffdf6390feed00cf5c5b255182d5b 100644 (file)
@@ -290,12 +290,10 @@ EXTRA_DIST = \
        missing/asprintf.c \
        missing/getopt.c \
        missing/getopt.h \
-       missing/snprintf.c \
        missing/strlcat.c \
        missing/strlcpy.c \
        missing/strtok_r.c \
        missing/win_asprintf.c \
-       missing/win_snprintf.c \
        mkdep \
        msdos/bin2c.c \
        msdos/makefile \
index ab41d1ef98bd7c393db81396d1893c2345954f84..42a7ad0aa3e5951eabb95572526c7b86159bb5f5 100644 (file)
@@ -46,13 +46,13 @@ bpf_image(const struct bpf_insn *p, int n)
 
        default:
                op = "unimp";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "0x%x", p->code);
+               (void)snprintf(operand_buf, sizeof operand_buf, "0x%x", p->code);
                operand = operand_buf;
                break;
 
        case BPF_RET|BPF_K:
                op = "ret";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
                operand = operand_buf;
                break;
 
@@ -63,19 +63,19 @@ bpf_image(const struct bpf_insn *p, int n)
 
        case BPF_LD|BPF_W|BPF_ABS:
                op = "ld";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "[%d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "[%d]", p->k);
                operand = operand_buf;
                break;
 
        case BPF_LD|BPF_H|BPF_ABS:
                op = "ldh";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "[%d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "[%d]", p->k);
                operand = operand_buf;
                break;
 
        case BPF_LD|BPF_B|BPF_ABS:
                op = "ldb";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "[%d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "[%d]", p->k);
                operand = operand_buf;
                break;
 
@@ -86,91 +86,91 @@ bpf_image(const struct bpf_insn *p, int n)
 
        case BPF_LD|BPF_W|BPF_IND:
                op = "ld";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "[x + %d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "[x + %d]", p->k);
                operand = operand_buf;
                break;
 
        case BPF_LD|BPF_H|BPF_IND:
                op = "ldh";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "[x + %d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "[x + %d]", p->k);
                operand = operand_buf;
                break;
 
        case BPF_LD|BPF_B|BPF_IND:
                op = "ldb";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "[x + %d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "[x + %d]", p->k);
                operand = operand_buf;
                break;
 
        case BPF_LD|BPF_IMM:
                op = "ld";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
                operand = operand_buf;
                break;
 
        case BPF_LDX|BPF_IMM:
                op = "ldx";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
                operand = operand_buf;
                break;
 
        case BPF_LDX|BPF_MSH|BPF_B:
                op = "ldxb";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "4*([%d]&0xf)", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "4*([%d]&0xf)", p->k);
                operand = operand_buf;
                break;
 
        case BPF_LD|BPF_MEM:
                op = "ld";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
                operand = operand_buf;
                break;
 
        case BPF_LDX|BPF_MEM:
                op = "ldx";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ST:
                op = "st";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
                operand = operand_buf;
                break;
 
        case BPF_STX:
                op = "stx";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "M[%d]", p->k);
                operand = operand_buf;
                break;
 
        case BPF_JMP|BPF_JA:
                op = "ja";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "%d", n + 1 + p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "%d", n + 1 + p->k);
                operand = operand_buf;
                break;
 
        case BPF_JMP|BPF_JGT|BPF_K:
                op = "jgt";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
                operand = operand_buf;
                break;
 
        case BPF_JMP|BPF_JGE|BPF_K:
                op = "jge";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
                operand = operand_buf;
                break;
 
        case BPF_JMP|BPF_JEQ|BPF_K:
                op = "jeq";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
                operand = operand_buf;
                break;
 
        case BPF_JMP|BPF_JSET|BPF_K:
                op = "jset";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
                operand = operand_buf;
                break;
 
@@ -246,61 +246,61 @@ bpf_image(const struct bpf_insn *p, int n)
 
        case BPF_ALU|BPF_ADD|BPF_K:
                op = "add";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ALU|BPF_SUB|BPF_K:
                op = "sub";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ALU|BPF_MUL|BPF_K:
                op = "mul";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ALU|BPF_DIV|BPF_K:
                op = "div";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ALU|BPF_MOD|BPF_K:
                op = "mod";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ALU|BPF_AND|BPF_K:
                op = "and";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ALU|BPF_OR|BPF_K:
                op = "or";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ALU|BPF_XOR|BPF_K:
                op = "xor";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#0x%x", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ALU|BPF_LSH|BPF_K:
                op = "lsh";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
                operand = operand_buf;
                break;
 
        case BPF_ALU|BPF_RSH|BPF_K:
                op = "rsh";
-               (void)pcap_snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
+               (void)snprintf(operand_buf, sizeof operand_buf, "#%d", p->k);
                operand = operand_buf;
                break;
 
@@ -320,11 +320,11 @@ bpf_image(const struct bpf_insn *p, int n)
                break;
        }
        if (BPF_CLASS(p->code) == BPF_JMP && BPF_OP(p->code) != BPF_JA) {
-               (void)pcap_snprintf(image, sizeof image,
+               (void)snprintf(image, sizeof image,
                              "(%03d) %-8s %-16s jt %d\tjf %d",
                              n, op, operand, n + 1 + p->jt, n + 1 + p->jf);
        } else {
-               (void)pcap_snprintf(image, sizeof image,
+               (void)snprintf(image, sizeof image,
                              "(%03d) %-8s %s",
                              n, op, operand);
        }
index b7ca36c71af6b45bbe5ff0ade9aa9b005133e537..fa895b188a1165d9ff65753eb9418e19fdcbe1e5 100644 (file)
 /* define if you have the Myricom SNF API */
 #undef HAVE_SNF_API
 
-/* Define to 1 if you have the `snprintf' function. */
-#undef HAVE_SNPRINTF
-
 /* Define to 1 if the system has the type `socklen_t'. */
 #undef HAVE_SOCKLEN_T
 
 /* Define to 1 if you have the `vasprintf' function. */
 #undef HAVE_VASPRINTF
 
-/* Define to 1 if you have the `vsnprintf' function. */
-#undef HAVE_VSNPRINTF
-
 /* Define to 1 if you have the `vsyslog' function. */
 #undef HAVE_VSYSLOG
 
index 585b416890a21dc6929ffa20d498272dff415249..3df88aae570321e0f7580eba07f79547b139c0b9 100755 (executable)
--- a/configure
+++ b/configure
@@ -719,7 +719,6 @@ infodir
 docdir
 oldincludedir
 includedir
-runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -821,7 +820,6 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1074,15 +1072,6 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
-  -runstatedir | --runstatedir | --runstatedi | --runstated \
-  | --runstate | --runstat | --runsta | --runst | --runs \
-  | --run | --ru | --r)
-    ac_prev=runstatedir ;;
-  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
-  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
-  | --run=* | --ru=* | --r=*)
-    runstatedir=$ac_optarg ;;
-
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1220,7 +1209,7 @@ fi
 for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
                datadir sysconfdir sharedstatedir localstatedir includedir \
                oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir runstatedir
+               libdir localedir mandir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1373,7 +1362,6 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
-  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -4542,7 +4530,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4588,7 +4576,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4612,7 +4600,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4657,7 +4645,7 @@ else
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -4681,7 +4669,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     We can't simply define LARGE_OFF_T to be 9223372036854775807,
     since some C++ compilers masquerading as C compilers
     incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) << 31))
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
@@ -5445,41 +5433,22 @@ done
 
 
 #
-# Either:
-#
-#      we have snprintf() and vsnprintf(), and have asprintf() and
-#      vasprintf();
-#
-#      we have snprintf() and vsnprintf(), but don't have asprintf()
-#      or vasprintf();
-#
-#      we have neither snprintf() nor vsnprintf(), and don't have
-#      asprintf() or vasprintf(), either.
+# Make sure we have vsnprintf() and snprintf(); we require them.
 #
-# We assume that if we have asprintf() we have vasprintf(), as well
-# as snprintf() and vsnprintf(), and that if we have snprintf() we
-# have vsnprintf().
-#
-# For the first case, we don't need any replacement routines.
-# For the second case, we need replacement asprintf()/vasprintf()
-# routines.
-# For the third case, we need replacement snprintf()/vsnprintf() and
-# asprintf()/vasprintf() routines.
-#
-needsnprintf=no
-for ac_func in vsnprintf snprintf
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
+if test "x$ac_cv_func_vsnprintf" = xyes; then :
 
 else
-  needsnprintf=yes
+  as_fn_error $? "vsnprintf() is required but wasn't found" "$LINENO" 5
 fi
-done
+
+ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
+if test "x$ac_cv_func_snprintf" = xyes; then :
+
+else
+  as_fn_error $? "snprintf() is required but wasn't found" "$LINENO" 5
+fi
+
 
 needasprintf=no
 for ac_func in vasprintf asprintf
@@ -5496,23 +5465,7 @@ else
 fi
 done
 
-if test $needsnprintf = yes; then
-       #
-       # We assume we have none of them; missing/snprintf.c supplies
-       # all of them.
-       #
-       case " $LIBOBJS " in
-  *" snprintf.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS snprintf.$ac_objext"
- ;;
-esac
-
-elif test $needasprintf = yes; then
-       #
-       # We assume we have snprintf()/vsnprintf() but lack
-       # asprintf()/vasprintf(); missing/asprintf.c supplies
-       # the latter (using vsnprintf()).
-       #
+if test $needasprintf = yes; then
        case " $LIBOBJS " in
   *" asprintf.$ac_objext "* ) ;;
   *) LIBOBJS="$LIBOBJS asprintf.$ac_objext"
index d57e5b877930cafc678c3a808c157b1bd724144d..c9fdf618763e91d19eeb7987c6c3a7e1acf6f154 100644 (file)
@@ -159,45 +159,17 @@ main(void)
 AC_CHECK_FUNCS(vsyslog)
 
 #
-# Either:
+# Make sure we have vsnprintf() and snprintf(); we require them.
 #
-#      we have snprintf() and vsnprintf(), and have asprintf() and
-#      vasprintf();
-#
-#      we have snprintf() and vsnprintf(), but don't have asprintf()
-#      or vasprintf();
-#
-#      we have neither snprintf() nor vsnprintf(), and don't have
-#      asprintf() or vasprintf(), either.
-#
-# We assume that if we have asprintf() we have vasprintf(), as well
-# as snprintf() and vsnprintf(), and that if we have snprintf() we
-# have vsnprintf().
-#
-# For the first case, we don't need any replacement routines.
-# For the second case, we need replacement asprintf()/vasprintf()
-# routines.
-# For the third case, we need replacement snprintf()/vsnprintf() and
-# asprintf()/vasprintf() routines.
-#
-needsnprintf=no
-AC_CHECK_FUNCS(vsnprintf snprintf,,
-       [needsnprintf=yes])
+AC_CHECK_FUNC(vsnprintf,,
+    AC_MSG_ERROR([vsnprintf() is required but wasn't found]))
+AC_CHECK_FUNC(snprintf,,
+    AC_MSG_ERROR([snprintf() is required but wasn't found]))
+
 needasprintf=no
 AC_CHECK_FUNCS(vasprintf asprintf,,
        [needasprintf=yes])
-if test $needsnprintf = yes; then
-       #
-       # We assume we have none of them; missing/snprintf.c supplies
-       # all of them.
-       #
-       AC_LIBOBJ([snprintf])
-elif test $needasprintf = yes; then
-       #
-       # We assume we have snprintf()/vsnprintf() but lack
-       # asprintf()/vasprintf(); missing/asprintf.c supplies
-       # the latter (using vsnprintf()).
-       #
+if test $needasprintf = yes; then
        AC_LIBOBJ([asprintf])
 fi
 
index b39c3d341982efe9852ec72aa6ba5413b0f3852d..87d45b9e74c9142a23e625a422f154e29740a410 100644 (file)
@@ -300,7 +300,7 @@ pcap_process_mactype(pcap_t *p, u_int mactype)
 #endif
 
        default:
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "unknown mactype 0x%x",
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "unknown mactype 0x%x",
                    mactype);
                retv = -1;
        }
index 6e63c15414fcd030dc0168de90755b94eb0f882c..ccb93c361e0819e1cae625d19d4b862f3051d296 100644 (file)
@@ -173,7 +173,7 @@ pcap_findalldevs_interfaces(pcap_if_list_t *devlistp, char *errbuf,
                 * Don't let the buffer size get bigger than INT_MAX.
                 */
                if (buf_size > INT_MAX) {
-                       (void)pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "interface information requires more than %u bytes",
                            INT_MAX);
                        (void)close(fd);
index 091e0d35eede0fd391470fca224f55d5163b09f4..d89a3976159da50b7786721ac3c7981a55c01ea4 100644 (file)
@@ -67,7 +67,7 @@ pcap_fmt_errmsg_for_errno(char *errbuf, size_t errbuflen, int errnum,
        size_t errbuflen_remaining;
 
        va_start(ap, fmt);
-       pcap_vsnprintf(errbuf, errbuflen, fmt, ap);
+       vsnprintf(errbuf, errbuflen, fmt, ap);
        va_end(ap);
        msglen = strlen(errbuf);
 
@@ -100,7 +100,7 @@ pcap_fmt_errmsg_for_errno(char *errbuf, size_t errbuflen, int errnum,
                 * It doesn't appear to be documented anywhere obvious
                 * what the error returns from strerror_s().
                 */
-               pcap_snprintf(p, errbuflen_remaining, "Error %d", errnum);
+               snprintf(p, errbuflen_remaining, "Error %d", errnum);
        }
 #elif defined(HAVE_GNU_STRERROR_R)
        /*
@@ -113,7 +113,7 @@ pcap_fmt_errmsg_for_errno(char *errbuf, size_t errbuflen, int errnum,
         */
        char strerror_buf[PCAP_ERRBUF_SIZE];
        char *errstring = strerror_r(errnum, strerror_buf, PCAP_ERRBUF_SIZE);
-       pcap_snprintf(p, errbuflen_remaining, "%s", errstring);
+       snprintf(p, errbuflen_remaining, "%s", errstring);
 #elif defined(HAVE_POSIX_STRERROR_R)
        /*
         * We have a POSIX-style strerror_r(), which is guaranteed to fill
@@ -125,14 +125,14 @@ pcap_fmt_errmsg_for_errno(char *errbuf, size_t errbuflen, int errnum,
                 * UNIX 03 says this isn't guaranteed to produce a
                 * fallback error message.
                 */
-               pcap_snprintf(p, errbuflen_remaining, "Unknown error: %d",
+               snprintf(p, errbuflen_remaining, "Unknown error: %d",
                    errnum);
        } else if (err == ERANGE) {
                /*
                 * UNIX 03 says this isn't guaranteed to produce a
                 * fallback error message.
                 */
-               pcap_snprintf(p, errbuflen_remaining,
+               snprintf(p, errbuflen_remaining,
                    "Message for error %d is too long", errnum);
        }
 #else
@@ -140,7 +140,7 @@ pcap_fmt_errmsg_for_errno(char *errbuf, size_t errbuflen, int errnum,
         * We have neither strerror_s() nor strerror_r(), so we're
         * stuck with using pcap_strerror().
         */
-       pcap_snprintf(p, errbuflen_remaining, "%s", pcap_strerror(errnum));
+       snprintf(p, errbuflen_remaining, "%s", pcap_strerror(errnum));
 #endif
 }
 
@@ -161,7 +161,7 @@ pcap_fmt_errmsg_for_win32_err(char *errbuf, size_t errbuflen, DWORD errnum,
        char win32_errbuf[PCAP_ERRBUF_SIZE+1];
 
        va_start(ap, fmt);
-       pcap_vsnprintf(errbuf, errbuflen, fmt, ap);
+       vsnprintf(errbuf, errbuflen, fmt, ap);
        va_end(ap);
        msglen = strlen(errbuf);
 
@@ -204,11 +204,11 @@ pcap_fmt_errmsg_for_win32_err(char *errbuf, size_t errbuflen, DWORD errnum,
                /*
                 * Failed.
                 */
-               pcap_snprintf(p, errbuflen_remaining,
+               snprintf(p, errbuflen_remaining,
                    "Couldn't get error message for error (%lu)", errnum);
                return;
        }
 
-       pcap_snprintf(p, errbuflen_remaining, "%s (%lu)", win32_errbuf, errnum);
+       snprintf(p, errbuflen_remaining, "%s (%lu)", win32_errbuf, errnum);
 }
 #endif
index 90128903218343103c210552921ccb6b5d90ff70..b4f2cc389279784b7023bbef3dab4198ff7cdaaa 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -443,7 +443,7 @@ bpf_set_error(compiler_state_t *cstate, const char *fmt, ...)
         */
        if (!cstate->error_set) {
                va_start(ap, fmt);
-               (void)pcap_vsnprintf(cstate->bpf_pcap->errbuf, PCAP_ERRBUF_SIZE,
+               (void)vsnprintf(cstate->bpf_pcap->errbuf, PCAP_ERRBUF_SIZE,
                    fmt, ap);
                va_end(ap);
                cstate->error_set = 1;
@@ -463,7 +463,7 @@ bpf_error(compiler_state_t *cstate, const char *fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       (void)pcap_vsnprintf(cstate->bpf_pcap->errbuf, PCAP_ERRBUF_SIZE,
+       (void)vsnprintf(cstate->bpf_pcap->errbuf, PCAP_ERRBUF_SIZE,
            fmt, ap);
        va_end(ap);
        longjmp(cstate->top_ctx, 1);
@@ -732,7 +732,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
         * link-layer type, so we can't use it.
         */
        if (!p->activated) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "not-yet-activated pcap_t passed to pcap_compile");
                return (-1);
        }
@@ -780,7 +780,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
 
        cstate.snaplen = pcap_snapshot(p);
        if (cstate.snaplen == 0) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                         "snaplen of 0 rejects all packets");
                rc = -1;
                goto quit;
@@ -831,7 +831,7 @@ pcap_compile(pcap_t *p, struct bpf_program *program,
                }
                if (cstate.ic.root == NULL ||
                    (cstate.ic.root->s.code == (BPF_RET|BPF_K) && cstate.ic.root->s.k == 0)) {
-                       (void)pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       (void)snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "expression rejects all packets");
                        rc = -1;
                        goto quit;
index 055eb80ac623a0d1509419f4032b5970ecf43aad..f461eeaff5e61de26af17d7efd3fa3fa91c92cbe 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 /* Prototypes missing in Digital UNIX 4.x */
-int    pcap_snprintf(char *, size_t, const char *, ...);
-int    pcap_vsnprintf(char *, size_t, const char *, va_list);
+int    snprintf(char *, size_t, const char *, ...);
+int    vsnprintf(char *, size_t, const char *, va_list);
 int    pfopen(char *, int);
 
index 5422f18f18a1f6736c634f0a74354b304d4ad420..52ab1750e1fd18b349dfcd3c1b2dd9745d3c07da 100644 (file)
 
 /*
  * Prototypes missing in Tru64 UNIX 5.x
- * XXX - "pcap_snprintf()" and "pcap_vsnprintf()" aren't missing, but you have to
+ * XXX - "snprintf()" and "vsnprintf()" aren't missing, but you have to
  * #define the right value to get them defined by <stdio.h>.
  */
-int    pcap_snprintf(char *, size_t, const char *, ...);
-int    pcap_vsnprintf(char *, size_t, const char *, va_list);
+int    snprintf(char *, size_t, const char *, ...);
+int    vsnprintf(char *, size_t, const char *, va_list);
 int    pfopen(char *, int);
 
index a555f5ed3147128c97c609f9e1034dfca548e497..22948b4a2695b1ea07dcb5f5916f93af1444299f 100644 (file)
@@ -21,4 +21,4 @@
 
 /* Prototypes missing in SunOS 5 */
 char    *strerror(int);
-int    pcap_snprintf(char *, size_t, const char *, ...);
+int    snprintf(char *, size_t, const char *, ...);
index 6353fb09cf6e42c44cc151f72d86e3c05662c952..ab032ef98dbdae495e8d3ab712845be4e8958861 100644 (file)
@@ -155,7 +155,7 @@ int sigsetmask(int);
 struct sigvec;
 #endif
 int    sigvec(int, struct sigvec *, struct sigvec*);
-int    pcap_snprintf(char *, size_t, const char *, ...);
+int    snprintf(char *, size_t, const char *, ...);
 int    socket(int, int, int);
 int    socketpair(int, int, int, int *);
 int    symlink(const char *, const char *);
diff --git a/missing/snprintf.c b/missing/snprintf.c
deleted file mode 100644 (file)
index 672aeb8..0000000
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute 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 BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * We use this for platforms that don't have snprintf() at all.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-
-#include "portability.h"
-
-enum format_flags {
-    minus_flag     =  1,
-    plus_flag      =  2,
-    space_flag     =  4,
-    alternate_flag =  8,
-    zero_flag      = 16
-};
-
-/*
- * Common state
- */
-
-struct state {
-  unsigned char *str;
-  unsigned char *s;
-  unsigned char *theend;
-  size_t sz;
-  size_t max_sz;
-  int (*append_char)(struct state *, unsigned char);
-  int (*reserve)(struct state *, size_t);
-  /* XXX - methods */
-};
-
-#ifndef HAVE_VSNPRINTF
-static int
-sn_reserve (struct state *state, size_t n)
-{
-  return state->s + n > state->theend;
-}
-
-static int
-sn_append_char (struct state *state, unsigned char c)
-{
-  if (sn_reserve (state, 1)) {
-    return 1;
-  } else {
-    *state->s++ = c;
-    return 0;
-  }
-}
-#endif
-
-#if 0
-static int
-as_reserve (struct state *state, size_t n)
-{
-  if (state->s + n > state->theend) {
-    int off = state->s - state->str;
-    unsigned char *tmp;
-
-    if (state->max_sz && state->sz >= state->max_sz)
-      return 1;
-
-    state->sz = max(state->sz * 2, state->sz + n);
-    if (state->max_sz)
-      state->sz = min(state->sz, state->max_sz);
-    tmp = realloc (state->str, state->sz);
-    if (tmp == NULL)
-      return 1;
-    state->str = tmp;
-    state->s = state->str + off;
-    state->theend = state->str + state->sz - 1;
-  }
-  return 0;
-}
-
-static int
-as_append_char (struct state *state, unsigned char c)
-{
-  if(as_reserve (state, 1))
-    return 1;
-  else {
-    *state->s++ = c;
-    return 0;
-  }
-}
-#endif
-
-static int
-append_number(struct state *state,
-             unsigned long num, unsigned base, char *rep,
-             int width, int prec, int flags, int minusp)
-{
-  int len = 0;
-  int i;
-
-  /* given precision, ignore zero flag */
-  if(prec != -1)
-    flags &= ~zero_flag;
-  else
-    prec = 1;
-  /* zero value with zero precision -> "" */
-  if(prec == 0 && num == 0)
-    return 0;
-  do{
-    if((*state->append_char)(state, rep[num % base]))
-      return 1;
-    len++;
-    num /= base;
-  }while(num);
-  prec -= len;
-  /* pad with prec zeros */
-  while(prec-- > 0){
-    if((*state->append_char)(state, '0'))
-      return 1;
-    len++;
-  }
-  /* add length of alternate prefix (added later) to len */
-  if(flags & alternate_flag && (base == 16 || base == 8))
-    len += base / 8;
-  /* pad with zeros */
-  if(flags & zero_flag){
-    width -= len;
-    if(minusp || (flags & space_flag) || (flags & plus_flag))
-      width--;
-    while(width-- > 0){
-      if((*state->append_char)(state, '0'))
-       return 1;
-      len++;
-    }
-  }
-  /* add alternate prefix */
-  if(flags & alternate_flag && (base == 16 || base == 8)){
-    if(base == 16)
-      if((*state->append_char)(state, rep[10] + 23)) /* XXX */
-       return 1;
-    if((*state->append_char)(state, '0'))
-      return 1;
-  }
-  /* add sign */
-  if(minusp){
-    if((*state->append_char)(state, '-'))
-      return 1;
-    len++;
-  } else if(flags & plus_flag) {
-    if((*state->append_char)(state, '+'))
-      return 1;
-    len++;
-  } else if(flags & space_flag) {
-    if((*state->append_char)(state, ' '))
-      return 1;
-    len++;
-  }
-  if(flags & minus_flag)
-    /* swap before padding with spaces */
-    for(i = 0; i < len / 2; i++){
-      char c = state->s[-i-1];
-      state->s[-i-1] = state->s[-len+i];
-      state->s[-len+i] = c;
-    }
-  width -= len;
-  while(width-- > 0){
-    if((*state->append_char)(state,  ' '))
-      return 1;
-    len++;
-  }
-  if(!(flags & minus_flag))
-    /* swap after padding with spaces */
-    for(i = 0; i < len / 2; i++){
-      char c = state->s[-i-1];
-      state->s[-i-1] = state->s[-len+i];
-      state->s[-len+i] = c;
-    }
-
-  return 0;
-}
-
-static int
-append_string (struct state *state,
-              unsigned char *arg,
-              int width,
-              int prec,
-              int flags)
-{
-  if(prec != -1)
-    width -= prec;
-  else
-    width -= strlen((char *)arg);
-  if(!(flags & minus_flag))
-    while(width-- > 0)
-      if((*state->append_char) (state, ' '))
-       return 1;
-  if (prec != -1) {
-    while (*arg && prec--)
-      if ((*state->append_char) (state, *arg++))
-       return 1;
-  } else {
-    while (*arg)
-      if ((*state->append_char) (state, *arg++))
-       return 1;
-  }
-  if(flags & minus_flag)
-    while(width-- > 0)
-      if((*state->append_char) (state, ' '))
-       return 1;
-  return 0;
-}
-
-static int
-append_char(struct state *state,
-           unsigned char arg,
-           int width,
-           int flags)
-{
-  while(!(flags & minus_flag) && --width > 0)
-    if((*state->append_char) (state, ' '))
-      return 1;
-
-  if((*state->append_char) (state, arg))
-    return 1;
-  while((flags & minus_flag) && --width > 0)
-    if((*state->append_char) (state, ' '))
-      return 1;
-
-  return 0;
-}
-
-/*
- * This can't be made into a function...
- */
-
-#define PARSE_INT_FORMAT(res, arg, unsig) \
-if (long_flag) \
-     res = (unsig long)va_arg(arg, unsig long); \
-else if (short_flag) \
-     res = (unsig short)va_arg(arg, unsig int); \
-else \
-     res = (unsig int)va_arg(arg, unsig int)
-
-/*
- * zyxprintf - return 0 or -1
- */
-
-static int
-xyzprintf (struct state *state, const char *char_format, va_list ap)
-{
-  const unsigned char *format = (const unsigned char *)char_format;
-  unsigned char c;
-
-  while((c = *format++)) {
-    if (c == '%') {
-      int flags      = 0;
-      int width      = 0;
-      int prec       = -1;
-      int long_flag  = 0;
-      int short_flag = 0;
-
-      /* flags */
-      while((c = *format++)){
-       if(c == '-')
-         flags |= minus_flag;
-       else if(c == '+')
-         flags |= plus_flag;
-       else if(c == ' ')
-         flags |= space_flag;
-       else if(c == '#')
-         flags |= alternate_flag;
-       else if(c == '0')
-         flags |= zero_flag;
-       else
-         break;
-      }
-
-      if((flags & space_flag) && (flags & plus_flag))
-       flags ^= space_flag;
-
-      if((flags & minus_flag) && (flags & zero_flag))
-       flags ^= zero_flag;
-
-      /* width */
-      if (isdigit(c))
-       do {
-         width = width * 10 + c - '0';
-         c = *format++;
-       } while(isdigit(c));
-      else if(c == '*') {
-       width = va_arg(ap, int);
-       c = *format++;
-      }
-
-      /* precision */
-      if (c == '.') {
-       prec = 0;
-       c = *format++;
-       if (isdigit(c))
-         do {
-           prec = prec * 10 + c - '0';
-           c = *format++;
-         } while(isdigit(c));
-       else if (c == '*') {
-         prec = va_arg(ap, int);
-         c = *format++;
-       }
-      }
-
-      /* size */
-
-      if (c == 'h') {
-       short_flag = 1;
-       c = *format++;
-      } else if (c == 'l') {
-       long_flag = 1;
-       c = *format++;
-      }
-
-      switch (c) {
-      case 'c' :
-       if(append_char(state, va_arg(ap, int), width, flags))
-         return -1;
-       break;
-      case 's' :
-       if (append_string(state,
-                         va_arg(ap, unsigned char*),
-                         width,
-                         prec,
-                         flags))
-         return -1;
-       break;
-      case 'd' :
-      case 'i' : {
-       long arg;
-       unsigned long num;
-       int minusp = 0;
-
-       PARSE_INT_FORMAT(arg, ap, signed);
-
-       if (arg < 0) {
-         minusp = 1;
-         num = -arg;
-       } else
-         num = arg;
-
-       if (append_number (state, num, 10, "0123456789",
-                          width, prec, flags, minusp))
-         return -1;
-       break;
-      }
-      case 'u' : {
-       unsigned long arg;
-
-       PARSE_INT_FORMAT(arg, ap, unsigned);
-
-       if (append_number (state, arg, 10, "0123456789",
-                          width, prec, flags, 0))
-         return -1;
-       break;
-      }
-      case 'o' : {
-       unsigned long arg;
-
-       PARSE_INT_FORMAT(arg, ap, unsigned);
-
-       if (append_number (state, arg, 010, "01234567",
-                          width, prec, flags, 0))
-         return -1;
-       break;
-      }
-      case 'x' : {
-       unsigned long arg;
-
-       PARSE_INT_FORMAT(arg, ap, unsigned);
-
-       if (append_number (state, arg, 0x10, "0123456789abcdef",
-                          width, prec, flags, 0))
-         return -1;
-       break;
-      }
-      case 'X' :{
-       unsigned long arg;
-
-       PARSE_INT_FORMAT(arg, ap, unsigned);
-
-       if (append_number (state, arg, 0x10, "0123456789ABCDEF",
-                          width, prec, flags, 0))
-         return -1;
-       break;
-      }
-      case 'p' : {
-       unsigned long arg = (unsigned long)va_arg(ap, void*);
-
-       if (append_number (state, arg, 0x10, "0123456789ABCDEF",
-                          width, prec, flags, 0))
-         return -1;
-       break;
-      }
-      case 'n' : {
-       int *arg = va_arg(ap, int*);
-       *arg = state->s - state->str;
-       break;
-      }
-      case '\0' :
-         --format;
-         /* FALLTHROUGH */
-      case '%' :
-       if ((*state->append_char)(state, c))
-         return -1;
-       break;
-      default :
-       if (   (*state->append_char)(state, '%')
-           || (*state->append_char)(state, c))
-         return -1;
-       break;
-      }
-    } else
-      if ((*state->append_char) (state, c))
-       return -1;
-  }
-  return 0;
-}
-
-#ifndef HAVE_SNPRINTF
-int
-pcap_snprintf (char *str, size_t sz, const char *format, ...)
-{
-  va_list args;
-  int ret;
-
-  va_start(args, format);
-  ret = pcap_vsnprintf (str, sz, format, args);
-
-#ifdef PARANOIA
-  {
-    int ret2;
-    char *tmp;
-
-    tmp = malloc (sz);
-    if (tmp == NULL)
-      abort ();
-
-    ret2 = pcap_vsprintf (tmp, format, args);
-    if (ret != ret2 || strcmp(str, tmp))
-      abort ();
-    free (tmp);
-  }
-#endif
-
-  va_end(args);
-  return ret;
-}
-#endif
-
-#if 0
-#ifndef HAVE_ASPRINTF
-int
-asprintf (char **ret, const char *format, ...)
-{
-  va_list args;
-  int val;
-
-  va_start(args, format);
-  val = vasprintf (ret, format, args);
-
-#ifdef PARANOIA
-  {
-    int ret2;
-    char *tmp;
-    tmp = malloc (val + 1);
-    if (tmp == NULL)
-      abort ();
-
-    ret2 = vsprintf (tmp, format, args);
-    if (val != ret2 || strcmp(*ret, tmp))
-      abort ();
-    free (tmp);
-  }
-#endif
-
-  va_end(args);
-  return val;
-}
-#endif
-
-#ifndef HAVE_ASNPRINTF
-int
-pcap_asnprintf (char **ret, size_t max_sz, const char *format, ...)
-{
-  va_list args;
-  int val;
-
-  va_start(args, format);
-  val = pcap_vasnprintf (ret, max_sz, format, args);
-  va_end(args);
-
-#ifdef PARANOIA
-  {
-    int ret2;
-    char *tmp;
-    tmp = malloc (val + 1);
-    if (tmp == NULL)
-      abort ();
-
-    va_start(args, format);
-    ret2 = pcap_vsprintf (tmp, format, args);
-    va_end(args);
-    if (val != ret2 || strcmp(*ret, tmp))
-      abort ();
-    free (tmp);
-  }
-#endif
-
-  return val;
-}
-#endif
-
-#ifndef HAVE_VASPRINTF
-int
-pcap_vasprintf (char **ret, const char *format, va_list args)
-{
-  return pcap_vasnprintf (ret, 0, format, args);
-}
-#endif
-
-
-#ifndef HAVE_VASNPRINTF
-int
-pcap_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
-{
-  int st;
-  size_t len;
-  struct state state;
-
-  state.max_sz = max_sz;
-  state.sz     = 1;
-  state.str    = malloc(state.sz);
-  if (state.str == NULL) {
-    *ret = NULL;
-    return -1;
-  }
-  state.s = state.str;
-  state.theend = state.s + state.sz - 1;
-  state.append_char = as_append_char;
-  state.reserve     = as_reserve;
-
-  st = xyzprintf (&state, format, args);
-  if (st) {
-    free (state.str);
-    *ret = NULL;
-    return -1;
-  } else {
-    char *tmp;
-
-    *state.s = '\0';
-    len = state.s - state.str;
-    tmp = realloc (state.str, len+1);
-    if (tmp == NULL) {
-      free (state.str);
-      *ret = NULL;
-      return -1;
-    }
-    *ret = tmp;
-    return len;
-  }
-}
-#endif
-#endif
-
-#ifndef HAVE_VSNPRINTF
-int
-pcap_vsnprintf (char *str, size_t sz, const char *format, va_list args)
-{
-  struct state state;
-  int ret;
-  unsigned char *ustr = (unsigned char *)str;
-
-  state.max_sz = 0;
-  state.sz     = sz;
-  state.str    = ustr;
-  state.s      = ustr;
-  state.theend = ustr + sz - 1;
-  state.append_char = sn_append_char;
-  state.reserve     = sn_reserve;
-
-  ret = xyzprintf (&state, format, args);
-  *state.s = '\0';
-  if (ret)
-    return sz;
-  else
-    return state.s - state.str;
-}
-#endif
-
index cce6296065fc80b9abcd44ccd0962e48a2ecdc21..e4bd13c61920e03ff8bb378180e9d8a3765f50a1 100644 (file)
@@ -23,7 +23,7 @@ pcap_vasprintf(char **strp, const char *format, va_list args)
                *strp = NULL;
                return (-1);
        }
-       ret = pcap_vsnprintf(str, str_size, format, args);
+       ret = vsnprintf(str, str_size, format, args);
        if (ret == -1) {
                free(str);
                *strp = NULL;
@@ -31,7 +31,7 @@ pcap_vasprintf(char **strp, const char *format, va_list args)
        }
        *strp = str;
        /*
-        * pcap_vsnprintf() shouldn't truncate the string, as we have
+        * vsnprintf() shouldn't truncate the string, as we have
         * allocated a buffer large enough to hold the string, so its
         * return value should be the number of characters printed.
         */
diff --git a/missing/win_snprintf.c b/missing/win_snprintf.c
deleted file mode 100644 (file)
index f422403..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdio.h>
-#include <stdarg.h>
-
-#include "portability.h"
-
-int
-pcap_vsnprintf(char *str, size_t str_size, const char *format, va_list args)
-{
-       int ret;
-
-       ret = _vsnprintf_s(str, str_size, _TRUNCATE, format, args);
-
-       /*
-        * XXX - _vsnprintf() and _snprintf() do *not* guarantee
-        * that str is null-terminated, but C99's vsnprintf()
-        * and snprintf() do, and we want to offer C99 behavior,
-        * so forcibly null-terminate the string.
-        *
-        * We don't, however, offer C99 behavior for the return
-        * value; _vsnprintf_s() returns -1, not the number of
-        * characters that would have been put into the buffer
-        * had it been large enough, if the string is truncated.
-        * The only way to get that value is to use _vscprintf();
-        * getting that count isn't worth the re-formatting.
-        *
-        * XXX - does _vsnprintf_s() return -1 on a formatting
-        * error?
-        */
-       str[str_size - 1] = '\0';
-       return (ret);
-}
-
-int
-pcap_snprintf(char *str, size_t str_size, const char *format, ...)
-{
-       va_list args;
-       int ret;
-
-       va_start(args, format);
-       ret = pcap_vsnprintf(str, str_size, format, args);
-       va_end(args);
-       return (ret);
-}
index 95a8378bd58b861d62e1151b42ebe61151854dc3..283a6de30fa3f6b99f576cc043a68b98a6722e34 100644 (file)
@@ -2069,7 +2069,7 @@ opt_error(opt_state_t *opt_state, const char *fmt, ...)
 
        if (opt_state->errbuf != NULL) {
                va_start(ap, fmt);
-               (void)pcap_vsnprintf(opt_state->errbuf,
+               (void)vsnprintf(opt_state->errbuf,
                    PCAP_ERRBUF_SIZE, fmt, ap);
                va_end(ap);
        }
@@ -2486,7 +2486,7 @@ icode_to_fcode(struct icode *ic, struct block *root, u_int *lenp,
 
            fp = (struct bpf_insn *)malloc(sizeof(*fp) * n);
            if (fp == NULL) {
-               (void)pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "malloc");
                free(fp);
                return NULL;
@@ -2513,7 +2513,7 @@ conv_error(conv_state_t *conv_state, const char *fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       (void)pcap_vsnprintf(conv_state->errbuf,
+       (void)vsnprintf(conv_state->errbuf,
            PCAP_ERRBUF_SIZE, fmt, ap);
        va_end(ap);
        longjmp(conv_state->top_ctx, 1);
@@ -2537,7 +2537,7 @@ install_bpf_program(pcap_t *p, struct bpf_program *fp)
         * Validate the program.
         */
        if (!pcap_validate_filter(fp->bf_insns, fp->bf_len)) {
-               pcap_snprintf(p->errbuf, sizeof(p->errbuf),
+               snprintf(p->errbuf, sizeof(p->errbuf),
                        "BPF program is not valid");
                return (-1);
        }
index 3f9e9ad5fe89ec105bd59d173eed764cf4fa3535..6bf002a94a05825d0b985e6cb12a254d1547e08d 100644 (file)
@@ -522,7 +522,7 @@ bpf_open(char *errbuf)
                 * that isn't in use.
                 */
                do {
-                       (void)pcap_snprintf(device, sizeof(device), "/dev/bpf%d", n++);
+                       (void)snprintf(device, sizeof(device), "/dev/bpf%d", n++);
                        /*
                         * Initially try a read/write open (to allow the inject
                         * method to work).  If that fails due to permission
@@ -557,7 +557,7 @@ bpf_open(char *errbuf)
                                 * means we probably have no BPF
                                 * devices.
                                 */
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "(there are no BPF devices)");
                        } else {
                                /*
@@ -566,7 +566,7 @@ bpf_open(char *errbuf)
                                 * devices, but all the ones
                                 * that exist are busy.
                                 */
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "(all BPF devices are busy)");
                        }
                        break;
@@ -1033,7 +1033,7 @@ pcap_read_bpf(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                                 * documented as having error returns
                                 * other than PCAP_ERROR or PCAP_ERROR_BREAK.
                                 */
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "The interface disappeared");
                                return (PCAP_ERROR);
 
@@ -1254,7 +1254,7 @@ bpf_odminit(char *errbuf)
        if (odm_initialize() == -1) {
                if (odm_err_msg(odmerrno, &errstr) == -1)
                        errstr = "Unknown error";
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "bpf_load: odm_initialize failed: %s",
                    errstr);
                return (PCAP_ERROR);
@@ -1263,7 +1263,7 @@ bpf_odminit(char *errbuf)
        if ((odmlockid = odm_lock("/etc/objrepos/config_lock", ODM_WAIT)) == -1) {
                if (odm_err_msg(odmerrno, &errstr) == -1)
                        errstr = "Unknown error";
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "bpf_load: odm_lock of /etc/objrepos/config_lock failed: %s",
                    errstr);
                (void)odm_terminate();
@@ -1282,7 +1282,7 @@ bpf_odmcleanup(char *errbuf)
                if (errbuf != NULL) {
                        if (odm_err_msg(odmerrno, &errstr) == -1)
                                errstr = "Unknown error";
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "bpf_load: odm_unlock failed: %s",
                            errstr);
                }
@@ -1293,7 +1293,7 @@ bpf_odmcleanup(char *errbuf)
                if (errbuf != NULL) {
                        if (odm_err_msg(odmerrno, &errstr) == -1)
                                errstr = "Unknown error";
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "bpf_load: odm_terminate failed: %s",
                            errstr);
                }
@@ -1356,7 +1356,7 @@ bpf_load(char *errbuf)
 
        if (rc == -1 || getmajor(sbuf.st_rdev) != major) {
                for (i = 0; i < BPF_MINORS; i++) {
-                       pcap_snprintf(buf, sizeof(buf), "%s%d", BPF_NODE, i);
+                       snprintf(buf, sizeof(buf), "%s%d", BPF_NODE, i);
                        unlink(buf);
                        if (mknod(buf, S_IRUSR | S_IFCHR, domakedev(major, i)) == -1) {
                                pcap_fmt_errmsg_for_errno(errbuf,
@@ -1369,7 +1369,7 @@ bpf_load(char *errbuf)
 
        /* Check if the driver is loaded */
        memset(&cfg_ld, 0x0, sizeof(cfg_ld));
-       pcap_snprintf(buf, sizeof(buf), "%s/%s", DRIVER_PATH, BPF_NAME);
+       snprintf(buf, sizeof(buf), "%s/%s", DRIVER_PATH, BPF_NAME);
        cfg_ld.path = buf;
        if ((sysconfig(SYS_QUERYLOAD, (void *)&cfg_ld, sizeof(cfg_ld)) == -1) ||
            (cfg_ld.kmid == 0)) {
@@ -1686,7 +1686,7 @@ pcap_activate_bpf(pcap_t *p)
        }
        if (bv.bv_major != BPF_MAJOR_VERSION ||
            bv.bv_minor < BPF_MINOR_VERSION) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "kernel bpf filter out of date");
                status = PCAP_ERROR;
                goto bad;
@@ -1726,7 +1726,7 @@ pcap_activate_bpf(pcap_t *p)
                char *lnamep;
 
                if (ifr.lifr_zoneid != GLOBAL_ZONEID) {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "zonename/linkname only valid in global zone.");
                        status = PCAP_ERROR;
                        goto bad;
@@ -1889,7 +1889,7 @@ pcap_activate_bpf(pcap_t *p)
                                 * "atexit()" failed; don't create the
                                 * interface, just give up.
                                 */
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                     "atexit failed");
                                close(s);
                                status = PCAP_ERROR;
@@ -1902,7 +1902,7 @@ pcap_activate_bpf(pcap_t *p)
                        pcap_strlcpy(ifr.ifr_name, p->opt.device, sizeof(ifr.ifr_name));
                        if (ioctl(s, SIOCIFCREATE2, &ifr) < 0) {
                                if (errno == EINVAL) {
-                                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                            "Invalid USB bus interface %s",
                                            p->opt.device);
                                } else {
@@ -2073,7 +2073,7 @@ pcap_activate_bpf(pcap_t *p)
                        }
 
                        if (v == 0) {
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "BIOCSBLEN: %s: No buffer size worked",
                                    p->opt.device);
                                status = PCAP_ERROR;
@@ -2117,7 +2117,7 @@ pcap_activate_bpf(pcap_t *p)
                /*
                 * We don't know what to map this to yet.
                 */
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "unknown interface type %u",
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "unknown interface type %u",
                    v);
                status = PCAP_ERROR;
                goto bad;
@@ -2429,7 +2429,7 @@ pcap_activate_bpf(pcap_t *p)
                /*
                 * We don't support immediate mode.  Fail.
                 */
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Immediate mode not supported");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Immediate mode not supported");
                status = PCAP_ERROR;
                goto bad;
        }
@@ -3281,7 +3281,7 @@ pcap_setdirection_bpf(pcap_t *p, pcap_direction_t d)
         * We don't support PCAP_D_OUT.
         */
        if (d == PCAP_D_OUT) {
-               pcap_snprintf(p->errbuf, sizeof(p->errbuf),
+               snprintf(p->errbuf, sizeof(p->errbuf),
                    "Setting direction to PCAP_D_OUT is not supported on BPF");
                return -1;
        }
@@ -3299,7 +3299,7 @@ pcap_setdirection_bpf(pcap_t *p, pcap_direction_t d)
 static int
 pcap_setdirection_bpf(pcap_t *p, pcap_direction_t d _U_)
 {
-       (void) pcap_snprintf(p->errbuf, sizeof(p->errbuf),
+       (void) snprintf(p->errbuf, sizeof(p->errbuf),
            "This system doesn't support BIOCSSEESENT, so the direction can't be set");
        return (-1);
 }
index 82a5554fb3645e88a3d1a39c5cd083624d419b95..ee7a44368379158e3a09288da4d55aec610aacf8 100644 (file)
@@ -92,7 +92,7 @@ bt_findalldevs(pcap_if_list_t *devlistp, char *err_str)
        dev_list = malloc(HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
        if (!dev_list)
        {
-               pcap_snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't allocate %zu bytes for Bluetooth device list",
+               snprintf(err_str, PCAP_ERRBUF_SIZE, "Can't allocate %zu bytes for Bluetooth device list",
                        HCI_MAX_DEV * sizeof(*dev_req) + sizeof(*dev_list));
                ret = -1;
                goto done;
@@ -112,8 +112,8 @@ bt_findalldevs(pcap_if_list_t *devlistp, char *err_str)
        for (i = 0; i < dev_list->dev_num; i++, dev_req++) {
                char dev_name[20], dev_descr[40];
 
-               pcap_snprintf(dev_name, sizeof(dev_name), BT_IFACE"%u", dev_req->dev_id);
-               pcap_snprintf(dev_descr, sizeof(dev_descr), "Bluetooth adapter number %u", i);
+               snprintf(dev_name, sizeof(dev_name), BT_IFACE"%u", dev_req->dev_id);
+               snprintf(dev_descr, sizeof(dev_descr), "Bluetooth adapter number %u", i);
 
                /*
                 * Bluetooth is a wireless technology.
@@ -194,7 +194,7 @@ bt_activate(pcap_t* handle)
        /* get bt interface id */
        if (sscanf(handle->opt.device, BT_IFACE"%d", &dev_id) != 1)
        {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                        "Can't get Bluetooth device index from %s",
                         handle->opt.device);
                return PCAP_ERROR;
@@ -380,7 +380,7 @@ bt_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char
 static int
 bt_inject_linux(pcap_t *handle, const void *buf _U_, int size _U_)
 {
-       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
            "Packet injection is not supported on Bluetooth devices");
        return (-1);
 }
index f7b37194a9f3884ac7e273f4ce8657fb25aed5db..3432d32553c70cf7974054e609520290de40fa4b 100644 (file)
@@ -149,7 +149,7 @@ bt_monitor_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_ch
 static int
 bt_monitor_inject(pcap_t *handle, const void *buf _U_, int size _U_)
 {
-    pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+    snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
         "Packet injection is not supported yet on Bluetooth monitor devices");
     return -1;
 }
index 5fd04ddd66c788827f256b55d1943b7b269c4250..d4b0f02953349c263e91885a136453effaf413a4 100644 (file)
@@ -749,7 +749,7 @@ static int dag_activate(pcap_t* p)
        struct timeval poll;
 
        if (device == NULL) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "device is NULL");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "device is NULL");
                return PCAP_ERROR;
        }
 
@@ -779,7 +779,7 @@ static int dag_activate(pcap_t* p)
 
        if (pd->dag_stream%2) {
                ret = PCAP_ERROR;
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "dag_parse_name: tx (even numbered) streams not supported for capture");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "dag_parse_name: tx (even numbered) streams not supported for capture");
                goto fail;
        }
 
@@ -935,7 +935,7 @@ static int dag_activate(pcap_t* p)
                                pd->dag_fcs_bits = n;
                        } else {
                                ret = PCAP_ERROR;
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                        "pcap_activate %s: bad ERF_FCS_BITS value (%d) in environment", device, n);
                                goto failstop;
                        }
@@ -1117,7 +1117,7 @@ dag_stats(pcap_t *p, struct pcap_stat *ps) {
                if ((dag_error = dag_config_get_uint32_attribute_ex(pd->dag_ref, pd->drop_attr, &stream_drop) == kDagErrNone)) {
                        pd->stat.ps_drop = stream_drop;
                } else {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "reading stream drop attribute: %s",
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "reading stream drop attribute: %s",
                                 dag_config_strerror(dag_error));
                        return -1;
                }
@@ -1145,10 +1145,10 @@ dag_findalldevs(pcap_if_list_t *devlistp, char *errbuf)
 
        /* Try all the DAGs 0-DAG_MAX_BOARDS */
        for (c = 0; c < DAG_MAX_BOARDS; c++) {
-               pcap_snprintf(name, 12, "dag%d", c);
+               snprintf(name, 12, "dag%d", c);
                if (-1 == dag_parse_name(name, dagname, DAGNAME_BUFSIZE, &dagstream))
                {
-                       (void) pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       (void) snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "dag: device name %s can't be parsed", name);
                        return (-1);
                }
@@ -1176,7 +1176,7 @@ dag_findalldevs(pcap_if_list_t *devlistp, char *errbuf)
                                if (0 == dag_attach_stream64(dagfd, stream, 0, 0)) {
                                        dag_detach_stream(dagfd, stream);
 
-                                       pcap_snprintf(name,  10, "dag%d:%d", c, stream);
+                                       snprintf(name,  10, "dag%d:%d", c, stream);
                                        if (add_dev(devlistp, name, 0, description, errbuf) == NULL) {
                                                /*
                                                 * Failure.
@@ -1426,7 +1426,7 @@ pcap_platform_finddevs(pcap_if_list_t *devlistp _U_, char *errbuf)
 pcap_t *
 pcap_create_interface(const char *device, char *errbuf)
 {
-       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(errbuf, PCAP_ERRBUF_SIZE,
            "This version of libpcap only supports DAG cards");
        return NULL;
 }
index 6b26d8ab741e87b098b7a5f9ea959df9b41632af..24c987a6c9a7c88c78ed11f62ccd50e78ca07498 100644 (file)
@@ -68,7 +68,7 @@ dbus_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char *us
        while (!message) {
                /* XXX handle->opt.timeout = timeout_ms; */
                if (!dbus_connection_read_write(handlep->conn, 100)) {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Connection closed");
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Connection closed");
                        return -1;
                }
 
@@ -81,7 +81,7 @@ dbus_read(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char *us
        }
 
        if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Disconnected");
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Disconnected");
                return -1;
        }
 
@@ -112,7 +112,7 @@ dbus_write(pcap_t *handle, const void *buf, int size)
        DBusMessage *msg;
 
        if (!(msg = dbus_message_demarshal(buf, size, &error))) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dbus_message_demarshal() failed: %s", error.message);
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "dbus_message_demarshal() failed: %s", error.message);
                dbus_error_free(&error);
                return -1;
        }
@@ -154,7 +154,7 @@ dbus_cleanup(pcap_t *handle)
 static int
 dbus_getnonblock(pcap_t *p)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Non-blocking mode isn't supported for capturing on D-Bus");
        return (-1);
 }
@@ -162,7 +162,7 @@ dbus_getnonblock(pcap_t *p)
 static int
 dbus_setnonblock(pcap_t *p, int nonblock _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Non-blocking mode isn't supported for capturing on D-Bus");
        return (-1);
 }
@@ -189,14 +189,14 @@ dbus_activate(pcap_t *handle)
 
        if (strcmp(dev, "dbus-system") == 0) {
                if (!(handlep->conn = dbus_bus_get(DBUS_BUS_SYSTEM, &error))) {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to get system bus: %s", error.message);
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to get system bus: %s", error.message);
                        dbus_error_free(&error);
                        return PCAP_ERROR;
                }
 
        } else if (strcmp(dev, "dbus-session") == 0) {
                if (!(handlep->conn = dbus_bus_get(DBUS_BUS_SESSION, &error))) {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to get session bus: %s", error.message);
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to get session bus: %s", error.message);
                        dbus_error_free(&error);
                        return PCAP_ERROR;
                }
@@ -205,19 +205,19 @@ dbus_activate(pcap_t *handle)
                const char *addr = dev + 7;
 
                if (!(handlep->conn = dbus_connection_open(addr, &error))) {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to open connection to: %s: %s", addr, error.message);
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to open connection to: %s: %s", addr, error.message);
                        dbus_error_free(&error);
                        return PCAP_ERROR;
                }
 
                if (!dbus_bus_register(handlep->conn, &error)) {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to register bus %s: %s\n", addr, error.message);
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to register bus %s: %s\n", addr, error.message);
                        dbus_error_free(&error);
                        return PCAP_ERROR;
                }
 
        } else {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't get bus address from %s", handle->opt.device);
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Can't get bus address from %s", handle->opt.device);
                return PCAP_ERROR;
        }
 
@@ -289,7 +289,7 @@ dbus_activate(pcap_t *handle)
                        /* try without eavesdrop */
                        dbus_bus_add_match(handlep->conn, rules[i] + strlen(EAVESDROPPING_RULE), &error);
                        if (dbus_error_is_set(&error)) {
-                               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to add bus match: %s\n", error.message);
+                               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Failed to add bus match: %s\n", error.message);
                                dbus_error_free(&error);
                                dbus_cleanup(handle);
                                return PCAP_ERROR;
index a8bfe6499802a3d2a467aa26106efe1a81a0414d..b32b98a7cb66b03b040826a14d8a1e8d63ccf47d 100644 (file)
@@ -263,7 +263,7 @@ pcap_inject_dlpi(pcap_t *p, const void *buf, int size)
        }
 #elif defined(DL_HP_RAWDLS)
        if (pd->send_fd < 0) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "send: Output FD couldn't be opened");
                return (-1);
        }
@@ -412,7 +412,7 @@ open_dlpi_device(const char *name, u_int *ppa, char *errbuf)
        if (*name == '/')
                pcap_strlcpy(dname, name, sizeof(dname));
        else
-               pcap_snprintf(dname, sizeof(dname), "%s/%s", PCAP_DEV_PREFIX,
+               snprintf(dname, sizeof(dname), "%s/%s", PCAP_DEV_PREFIX,
                    name);
 
        /*
@@ -470,7 +470,7 @@ open_dlpi_device(const char *name, u_int *ppa, char *errbuf)
                                 * interface is just a symptom of that
                                 * inability.
                                 */
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "%s: No DLPI device found", name);
                        } else {
                                if (errno == EPERM || errno == EACCES)
@@ -800,7 +800,7 @@ pcap_activate_dlpi(pcap_t *p)
        get_release(release, sizeof (release), &osmajor, &osminor, &osmicro);
        if (osmajor == 5 && (osminor <= 2 || (osminor == 3 && osmicro < 2)) &&
            getenv("BUFMOD_FIXED") == NULL) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                "WARNING: bufmod is broken in SunOS %s; ignoring snaplen.",
                    release);
                ss = 0;
@@ -875,7 +875,7 @@ split_dname(char *device, u_int *unitp, char *ebuf)
         */
        cp = device + strlen(device) - 1;
        if (*cp < '0' || *cp > '9') {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s missing unit number",
+               snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s missing unit number",
                    device);
                return (NULL);
        }
@@ -887,16 +887,16 @@ split_dname(char *device, u_int *unitp, char *ebuf)
        errno = 0;
        unit = strtol(cp, &eos, 10);
        if (*eos != '\0') {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s bad unit number", device);
+               snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s bad unit number", device);
                return (NULL);
        }
        if (errno == ERANGE || unit > INT_MAX) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s unit number too large",
+               snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s unit number too large",
                    device);
                return (NULL);
        }
        if (unit < 0) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s unit number is negative",
+               snprintf(ebuf, PCAP_ERRBUF_SIZE, "%s unit number is negative",
                    device);
                return (NULL);
        }
@@ -1110,7 +1110,7 @@ pcap_platform_finddevs(pcap_if_list_t *devlistp, char *errbuf)
                return (-1);
        }
        for (i = 0; i < buf.nunits; i++) {
-               pcap_snprintf(baname, sizeof baname, "ba%u", i);
+               snprintf(baname, sizeof baname, "ba%u", i);
                /*
                 * XXX - is there a notion of "up" and "running"?
                 * And is there a way to determine whether the
@@ -1197,7 +1197,7 @@ recv_ack(int fd, int size, const char *what, char *bufp, char *ebuf, int *uerror
                        break;
 
                default:
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "recv_ack: %s: %s", what,
                            dlstrerror(errmsgbuf, sizeof (errmsgbuf), dlp->error_ack.dl_errno));
                        if (dlp->error_ack.dl_errno == DL_BADPPA)
@@ -1209,14 +1209,14 @@ recv_ack(int fd, int size, const char *what, char *bufp, char *ebuf, int *uerror
                return (PCAP_ERROR);
 
        default:
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "recv_ack: %s: Unexpected primitive ack %s",
                    what, dlprim(dlprimbuf, sizeof (dlprimbuf), dlp->dl_primitive));
                return (PCAP_ERROR);
        }
 
        if (ctl.len < size) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "recv_ack: %s: Ack too small (%d < %d)",
                    what, ctl.len, size);
                return (PCAP_ERROR);
@@ -1327,7 +1327,7 @@ dlstrerror(char *errbuf, size_t errbufsize, bpf_u_int32 dl_errno)
                return ("Pending outstanding connect indications");
 
        default:
-               pcap_snprintf(errbuf, errbufsize, "Error %02x", dl_errno);
+               snprintf(errbuf, errbufsize, "Error %02x", dl_errno);
                return (errbuf);
        }
 }
@@ -1419,7 +1419,7 @@ dlprim(char *primbuf, size_t primbufsize, bpf_u_int32 prim)
                return ("DL_RESET_CON");
 
        default:
-               pcap_snprintf(primbuf, primbufsize, "unknown primitive 0x%x",
+               snprintf(primbuf, primbufsize, "unknown primitive 0x%x",
                    prim);
                return (primbuf);
        }
@@ -1646,21 +1646,21 @@ get_dlpi_ppa(register int fd, register const char *device, register u_int unit,
                return (PCAP_ERROR);
        }
        if (ctl.len == -1) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "get_dlpi_ppa: hpppa getmsg: control buffer has no data");
                return (PCAP_ERROR);
        }
 
        dlp = (dl_hp_ppa_ack_t *)ctl.buf;
        if (dlp->dl_primitive != DL_HP_PPA_ACK) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "get_dlpi_ppa: hpppa unexpected primitive ack 0x%x",
                    (bpf_u_int32)dlp->dl_primitive);
                return (PCAP_ERROR);
        }
 
        if ((size_t)ctl.len < DL_HP_PPA_ACK_SIZE) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "get_dlpi_ppa: hpppa ack too small (%d < %lu)",
                     ctl.len, (unsigned long)DL_HP_PPA_ACK_SIZE);
                return (PCAP_ERROR);
@@ -1683,12 +1683,12 @@ get_dlpi_ppa(register int fd, register const char *device, register u_int unit,
                return (PCAP_ERROR);
        }
        if (ctl.len == -1) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "get_dlpi_ppa: hpppa getmsg: control buffer has no data");
                return (PCAP_ERROR);
        }
        if ((u_int)ctl.len < dlp->dl_length) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "get_dlpi_ppa: hpppa ack too small (%d < %lu)",
                    ctl.len, (unsigned long)dlp->dl_length);
                free(ppa_data_buf);
@@ -1745,7 +1745,7 @@ get_dlpi_ppa(register int fd, register const char *device, register u_int unit,
                 * device number of a device with the name "/dev/<dev><unit>",
                 * if such a device exists, as the old code did.
                 */
-               pcap_snprintf(dname, sizeof(dname), "/dev/%s%u", device, unit);
+               snprintf(dname, sizeof(dname), "/dev/%s%u", device, unit);
                if (stat(dname, &statbuf) < 0) {
                        pcap_fmt_errmsg_for_errno(ebuf, PCAP_ERRBUF_SIZE,
                            errno, "stat: %s", dname);
@@ -1764,12 +1764,12 @@ get_dlpi_ppa(register int fd, register const char *device, register u_int unit,
                }
        }
        if (i == ap->dl_count) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "can't find /dev/dlpi PPA for %s%u", device, unit);
                return (PCAP_ERROR_NO_SUCH_DEVICE);
        }
        if (ip->dl_hdw_state == HDW_DEAD) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "%s%d: hardware state: DOWN\n", device, unit);
                free(ppa_data_buf);
                return (PCAP_ERROR);
@@ -1808,12 +1808,12 @@ get_dlpi_ppa(register int fd, register const char *ifname, register u_int unit,
        if (cp != NULL)
                ifname = cp + 1;
        if (nlist(path_vmunix, &nl) < 0) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE, "nlist %s failed",
+               snprintf(ebuf, PCAP_ERRBUF_SIZE, "nlist %s failed",
                    path_vmunix);
                return (PCAP_ERROR);
        }
        if (nl[NL_IFNET].n_value == 0) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                    "could't find %s kernel symbol",
                    nl[NL_IFNET].n_name);
                return (PCAP_ERROR);
@@ -1844,7 +1844,7 @@ get_dlpi_ppa(register int fd, register const char *ifname, register u_int unit,
                }
        }
 
-       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE, "Can't find %s", ifname);
+       snprintf(ebuf, PCAP_ERRBUF_SIZE, "Can't find %s", ifname);
        return (PCAP_ERROR_NO_SUCH_DEVICE);
 }
 
@@ -1865,7 +1865,7 @@ dlpi_kread(register int fd, register off_t addr,
                    errno, "read");
                return (-1);
        } else if (cc != len) {
-               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE, "short read (%d != %d)", cc,
+               snprintf(ebuf, PCAP_ERRBUF_SIZE, "short read (%d != %d)", cc,
                    len);
                return (-1);
        }
index cd153e8e5ff6ffad455bc61fb2ea29d26bbb04d2..5ab88593cc9cd5f5c0036c5b40e89244f4886cad 100644 (file)
@@ -215,7 +215,7 @@ static int pcap_activate_dos (pcap_t *pcap)
   }
   else if (stricmp(active_dev->name,pcap->opt.device))
   {
-    pcap_snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
+    snprintf (pcap->errbuf, PCAP_ERRBUF_SIZE,
                    "Cannot use different devices simultaneously "
                    "(`%s' vs. `%s')", active_dev->name, pcap->opt.device);
     /* XXX - free pcap->buffer? */
@@ -539,7 +539,7 @@ int pcap_lookupnet (const char *device, bpf_u_int32 *localnet,
        net = IN_CLASSC_NET;
     else
     {
-      pcap_snprintf (errbuf, PCAP_ERRBUF_SIZE, "inet class for 0x%lx unknown", mask);
+      snprintf (errbuf, PCAP_ERRBUF_SIZE, "inet class for 0x%lx unknown", mask);
       return (-1);
     }
   }
@@ -667,7 +667,7 @@ open_driver (const char *dev_name, char *ebuf, int promisc)
 
       if (!(*dev->probe)(dev))    /* call the xx_probe() function */
       {
-        pcap_snprintf (ebuf, PCAP_ERRBUF_SIZE, "failed to detect device `%s'", dev_name);
+        snprintf (ebuf, PCAP_ERRBUF_SIZE, "failed to detect device `%s'", dev_name);
         return (NULL);
       }
       probed_dev = dev;  /* device is probed okay and may be used */
@@ -689,7 +689,7 @@ open_driver (const char *dev_name, char *ebuf, int promisc)
 
     if (!(*dev->open)(dev))
     {
-      pcap_snprintf (ebuf, PCAP_ERRBUF_SIZE, "failed to activate device `%s'", dev_name);
+      snprintf (ebuf, PCAP_ERRBUF_SIZE, "failed to activate device `%s'", dev_name);
       if (pktInfo.error && !strncmp(dev->name,"pkt",3))
       {
         strcat (ebuf, ": ");
@@ -711,14 +711,14 @@ open_driver (const char *dev_name, char *ebuf, int promisc)
    */
   if (!dev)
   {
-    pcap_snprintf (ebuf, PCAP_ERRBUF_SIZE, "device `%s' not supported", dev_name);
+    snprintf (ebuf, PCAP_ERRBUF_SIZE, "device `%s' not supported", dev_name);
     return (NULL);
   }
 
 not_probed:
   if (!probed_dev)
   {
-    pcap_snprintf (ebuf, PCAP_ERRBUF_SIZE, "device `%s' not probed", dev_name);
+    snprintf (ebuf, PCAP_ERRBUF_SIZE, "device `%s' not probed", dev_name);
     return (NULL);
   }
   return (dev);
@@ -1005,7 +1005,7 @@ static int init_watt32 (struct pcap *pcap, const char *dev_name, char *err_buf)
   }
   else if (rc && using_pktdrv)
   {
-    pcap_snprintf (err_buf, PCAP_ERRBUF_SIZE, "sock_init() failed, code %d", rc);
+    snprintf (err_buf, PCAP_ERRBUF_SIZE, "sock_init() failed, code %d", rc);
     return (0);
   }
 
index 0d4456db431dd2c1b54e0a0c90e2744d9d254d5b..ed33ff3246db40fa4653a6d089ce8b1fc533b7a1 100644 (file)
@@ -208,7 +208,7 @@ static void dpdk_fmt_errmsg_for_rte_errno(char *errbuf, size_t errbuflen,
        size_t errbuflen_remaining;
 
        va_start(ap, fmt);
-       pcap_vsnprintf(errbuf, errbuflen, fmt, ap);
+       vsnprintf(errbuf, errbuflen, fmt, ap);
        va_end(ap);
        msglen = strlen(errbuf);
 
@@ -236,7 +236,7 @@ static void dpdk_fmt_errmsg_for_rte_errno(char *errbuf, size_t errbuflen,
         * buffer (based on the "PER_LCORE" in "RTE_DEFINE_PER_LCORE" used
         * to declare the buffers statically) for DPDK errors.
         */
-       pcap_snprintf(p, errbuflen_remaining, "%s", rte_strerror(errnum));
+       snprintf(p, errbuflen_remaining, "%s", rte_strerror(errnum));
 }
 
 static int dpdk_init_timer(struct pcap_dpdk *pd){
@@ -477,7 +477,7 @@ static void eth_addr_str(struct ether_addr *addrp, char* mac_str, int len)
 {
        int offset=0;
        if (addrp == NULL){
-               pcap_snprintf(mac_str, len-1, DPDK_DEF_MAC_ADDR);
+               snprintf(mac_str, len-1, DPDK_DEF_MAC_ADDR);
                return;
        }
        for (int i=0; i<6; i++)
@@ -488,10 +488,10 @@ static void eth_addr_str(struct ether_addr *addrp, char* mac_str, int len)
                }
                if (i==0)
                {
-                       pcap_snprintf(mac_str+offset, len-1-offset, "%02X",addrp->addr_bytes[i]);
+                       snprintf(mac_str+offset, len-1-offset, "%02X",addrp->addr_bytes[i]);
                        offset+=2; // FF
                }else{
-                       pcap_snprintf(mac_str+offset, len-1-offset, ":%02X", addrp->addr_bytes[i]);
+                       snprintf(mac_str+offset, len-1-offset, ":%02X", addrp->addr_bytes[i]);
                        offset+=3; // :FF
                }
        }
@@ -623,7 +623,7 @@ error:
                        if (eaccess_not_fatal)
                                return 0;
                        // Otherwise report a fatal error.
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "DPDK requires that it run as root");
                        return PCAP_ERROR_PERM_DENIED;
 
@@ -633,7 +633,7 @@ error:
                        // be attempted again."
                        // There's no such error in pcap, so I'm
                        // not sure what we should do here.
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "Bus or system resource was not available");
                        break;
 
@@ -650,7 +650,7 @@ error:
                case EFAULT:
                        // This "indicates the tailq configuration
                        // name was not found in memory configuration."
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "The tailq configuration name was not found in the memory configuration");
                        return PCAP_ERROR;
 
@@ -658,20 +658,20 @@ error:
                        // This "indicates invalid parameters were
                        // passed as argv/argc."  Those came from
                        // the configuration file.
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "The configuration file has invalid parameters");
                        break;
 
                case ENOMEM:
                        // This "indicates failure likely caused by
                        // an out-of-memory condition."
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "Out of memory");
                        break;
 
                case ENODEV:
                        // This "indicates memory setup issues."
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "An error occurred setting up memory");
                        break;
 
@@ -697,14 +697,14 @@ error:
                        // as a "not available" case?  If not, we
                        // can't distinguish between the two, so
                        // we're stuck.
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "PCI bus is not present or not readable by the EAL");
                        break;
 
                case ENOEXEC:
                        // This "indicates that a service core
                        // failed to launch successfully."
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "A service core failed to launch successfully");
                        break;
 
@@ -744,7 +744,7 @@ static int pcap_dpdk_activate(pcap_t *p)
                if (ret < 0)
                {
                        // This returns a negative value on an error.
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "Can't open device %s: %s",
                            p->opt.device, dpdk_pre_init_errbuf);
                        // ret is set to the correct error
@@ -753,7 +753,7 @@ static int pcap_dpdk_activate(pcap_t *p)
                if (ret == 0)
                {
                        // This means DPDK isn't available on this machine.
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "Can't open device %s: DPDK is not available on this machine",
                            p->opt.device);
                        return PCAP_ERROR_NO_SUCH_DEVICE;
@@ -762,7 +762,7 @@ static int pcap_dpdk_activate(pcap_t *p)
                ret = dpdk_init_timer(pd);
                if (ret<0)
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                "dpdk error: Init timer is zero with device %s",
                                p->opt.device);
                        ret = PCAP_ERROR;
@@ -772,7 +772,7 @@ static int pcap_dpdk_activate(pcap_t *p)
                nb_ports = rte_eth_dev_count_avail();
                if (nb_ports == 0)
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "dpdk error: No Ethernet ports");
                        ret = PCAP_ERROR;
                        break;
@@ -780,7 +780,7 @@ static int pcap_dpdk_activate(pcap_t *p)
 
                portid = portid_by_device(p->opt.device);
                if (portid == DPDK_PORTID_MAX){
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "dpdk error: portid is invalid. device %s",
                            p->opt.device);
                        ret = PCAP_ERROR_NO_SUCH_DEVICE;
@@ -875,7 +875,7 @@ static int pcap_dpdk_activate(pcap_t *p)
                                rte_eth_dev_socket_id(portid));
                if (tx_buffer == NULL)
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "dpdk error: Cannot allocate buffer for tx on port %u", portid);
                        ret = PCAP_ERROR;
                        break;
@@ -900,7 +900,7 @@ static int pcap_dpdk_activate(pcap_t *p)
                // check link status
                is_port_up = check_link_status(portid, &link);
                if (!is_port_up){
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "dpdk error: link is down, port=%u",portid);
                        ret = PCAP_ERROR_IFACE_NOT_UP;
                        break;
@@ -985,7 +985,7 @@ int pcap_dpdk_findalldevs(pcap_if_list_t *devlistp, char *ebuf)
                if (ret < 0)
                {
                        // This returns a negative value on an error.
-                       pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                       snprintf(ebuf, PCAP_ERRBUF_SIZE,
                            "Can't look for DPDK devices: %s",
                            dpdk_pre_init_errbuf);
                        ret = PCAP_ERROR;
@@ -1005,14 +1005,14 @@ int pcap_dpdk_findalldevs(pcap_if_list_t *devlistp, char *ebuf)
                        break;
                }
                for (unsigned int i=0; i<nb_ports; i++){
-                       pcap_snprintf(dpdk_name, DPDK_DEV_NAME_MAX-1,
+                       snprintf(dpdk_name, DPDK_DEV_NAME_MAX-1,
                            "%s%u", DPDK_PREFIX, i);
                        // mac addr
                        rte_eth_macaddr_get(i, &eth_addr);
                        eth_addr_str(&eth_addr,mac_addr,DPDK_MAC_ADDR_SIZE);
                        // PCI addr
                        rte_eth_dev_get_name_by_port(i,pci_addr);
-                       pcap_snprintf(dpdk_desc,DPDK_DEV_DESC_MAX-1,"%s %s, MAC:%s, PCI:%s", DPDK_DESC, dpdk_name, mac_addr, pci_addr);
+                       snprintf(dpdk_desc,DPDK_DEV_DESC_MAX-1,"%s %s, MAC:%s, PCI:%s", DPDK_DESC, dpdk_name, mac_addr, pci_addr);
                        if (add_dev(devlistp, dpdk_name, 0, dpdk_desc, ebuf)==NULL){
                                ret = PCAP_ERROR;
                                break;
@@ -1042,7 +1042,7 @@ pcap_platform_finddevs(pcap_if_list_t *devlistp _U_, char *errbuf)
 pcap_t *
 pcap_create_interface(const char *device, char *errbuf)
 {
-       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(errbuf, PCAP_ERRBUF_SIZE,
            "This version of libpcap only supports DPDK");
        return NULL;
 }
index aef18fa2d38ce21a7b7a4405ef082d48590cd8dd..68328b4be37449906632f49ab75c450568021960 100644 (file)
@@ -468,7 +468,7 @@ pcap_cleanup_libdlpi(pcap_t *p)
 static void
 pcap_libdlpi_err(const char *linkname, const char *func, int err, char *errbuf)
 {
-       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "libpcap: %s failed on %s: %s",
+       snprintf(errbuf, PCAP_ERRBUF_SIZE, "libpcap: %s failed on %s: %s",
            func, linkname, dlpi_strerror(err));
 }
 
index e310d6b7ab7a028b04d62496c2c8d5e78cc6ff45..8a2796efcf4ec0718602fc1180bc667a3c509a52 100644 (file)
@@ -618,7 +618,7 @@ get_mac80211_phydev(pcap_t *handle, const char *device, char *phydev_path,
         * Generate the path string for the symlink to the physical device.
         */
        if (asprintf(&pathstr, "/sys/class/net/%s/phy80211", device) == -1) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: Can't generate path name string for /sys/class/net device",
                    device);
                return PCAP_ERROR;
@@ -689,20 +689,20 @@ nl80211_init(pcap_t *handle, struct nl80211_state *state, const char *device)
 
        state->nl_sock = nl_socket_alloc();
        if (!state->nl_sock) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: failed to allocate netlink handle", device);
                return PCAP_ERROR;
        }
 
        if (genl_connect(state->nl_sock)) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: failed to connect to generic netlink", device);
                goto out_handle_destroy;
        }
 
        err = genl_ctrl_alloc_cache(state->nl_sock, &state->nl_cache);
        if (err < 0) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: failed to allocate generic netlink cache: %s",
                    device, get_nl_errmsg(-err));
                goto out_handle_destroy;
@@ -710,7 +710,7 @@ nl80211_init(pcap_t *handle, struct nl80211_state *state, const char *device)
 
        state->nl80211 = genl_ctrl_search_by_name(state->nl_cache, "nl80211");
        if (!state->nl80211) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: nl80211 not found", device);
                goto out_cache_free;
        }
@@ -751,7 +751,7 @@ add_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
 
        msg = nlmsg_alloc();
        if (!msg) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: failed to allocate netlink msg", device);
                return PCAP_ERROR;
        }
@@ -785,7 +785,7 @@ DIAG_ON_NARROWING
                         * Real failure, not just "that device is not
                         * available.
                         */
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                            "%s: nl_send_auto_complete failed adding %s interface: %s",
                            device, mondevice, get_nl_errmsg(-err));
                        nlmsg_free(msg);
@@ -813,7 +813,7 @@ DIAG_ON_NARROWING
                         * Real failure, not just "that device is not
                         * available.
                         */
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                            "%s: nl_wait_for_ack failed adding %s interface: %s",
                            device, mondevice, get_nl_errmsg(-err));
                        nlmsg_free(msg);
@@ -842,7 +842,7 @@ DIAG_ON_NARROWING
        return 1;
 
 nla_put_failure:
-       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
            "%s: nl_put failed adding %s interface",
            device, mondevice);
        nlmsg_free(msg);
@@ -863,7 +863,7 @@ del_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
 
        msg = nlmsg_alloc();
        if (!msg) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: failed to allocate netlink msg", device);
                return PCAP_ERROR;
        }
@@ -874,7 +874,7 @@ del_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
 
        err = nl_send_auto_complete(state->nl_sock, msg);
        if (err < 0) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: nl_send_auto_complete failed deleting %s interface: %s",
                    device, mondevice, get_nl_errmsg(-err));
                nlmsg_free(msg);
@@ -882,7 +882,7 @@ del_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
        }
        err = nl_wait_for_ack(state->nl_sock);
        if (err < 0) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: nl_wait_for_ack failed adding %s interface: %s",
                    device, mondevice, get_nl_errmsg(-err));
                nlmsg_free(msg);
@@ -896,7 +896,7 @@ del_mon_if(pcap_t *handle, int sock_fd, struct nl80211_state *state,
        return 1;
 
 nla_put_failure:
-       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
            "%s: nl_put failed deleting %s interface",
            device, mondevice);
        nlmsg_free(msg);
@@ -941,7 +941,7 @@ enter_rfmon_mode_mac80211(pcap_t *handle, int sock_fd, const char *device)
                 */
                char mondevice[3+10+1]; /* mon{UINT_MAX}\0 */
 
-               pcap_snprintf(mondevice, sizeof mondevice, "mon%u", n);
+               snprintf(mondevice, sizeof mondevice, "mon%u", n);
                ret = add_mon_if(handle, sock_fd, &nlstate, device, mondevice);
                if (ret == 1) {
                        /*
@@ -960,7 +960,7 @@ enter_rfmon_mode_mac80211(pcap_t *handle, int sock_fd, const char *device)
                }
        }
 
-       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
            "%s: No free monN interfaces", device);
        nl80211_cleanup(&nlstate);
        return PCAP_ERROR;
@@ -1589,7 +1589,7 @@ open_pf_packet_socket(pcap_t *handle, int cooked)
                         * spontaneously drop its support for PF_PACKET
                         * sockets).
                         */
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                            "PF_PACKET sockets not supported (this \"can't happen\"!");
                        return PCAP_ERROR_NO_PF_PACKET_SOCKETS;
                }
@@ -1691,7 +1691,7 @@ pcap_activate_linux(pcap_t *handle)
                if (handle->opt.promisc) {
                        handle->opt.promisc = 0;
                        /* Just a warning. */
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                            "Promiscuous mode not supported on the \"any\" device");
                        status = PCAP_WARNING_PROMISC_NOTSUP;
                }
@@ -2048,7 +2048,7 @@ pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata)
                         * PCAP_ERROR_IFACE_NOT_UP, but pcap_dispatch()
                         * etc. aren't defined to return that.
                         */
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                "The interface went down");
                        return PCAP_ERROR;
 
@@ -2670,7 +2670,7 @@ scan_sys_class_net(pcap_if_list_t *devlistp, char *errbuf)
                 * for devices, newer kernels have symlinks to
                 * directories.)
                 */
-               pcap_snprintf(subsystem_path, sizeof subsystem_path,
+               snprintf(subsystem_path, sizeof subsystem_path,
                    "/sys/class/net/%s/ifindex", ent->d_name);
                if (lstat(subsystem_path, &statb) != 0) {
                        /*
@@ -2862,7 +2862,7 @@ get_if_flags(const char *name, bpf_u_int32 *flags, char *errbuf)
                char *pathstr;
 
                if (asprintf(&pathstr, "/sys/class/net/%s/type", name) == -1) {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "%s: Can't generate path name string for /sys/class/net device",
                            name);
                        close(sock);
@@ -3231,7 +3231,7 @@ pcap_setdirection_linux(pcap_t *handle, pcap_direction_t d)
         * We're not using PF_PACKET sockets, so we can't determine
         * the direction of the packet.
         */
-       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
            "Setting direction is not supported on SOCK_PACKET sockets");
        return -1;
 }
@@ -3964,7 +3964,7 @@ activate_new(pcap_t *handle, int is_any_device)
                                 * update "map_arphrd_to_dlt()"
                                 * to handle the new type.
                                 */
-                               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                        "arptype %d not "
                                        "supported by libpcap - "
                                        "falling back to cooked "
@@ -3982,7 +3982,7 @@ activate_new(pcap_t *handle, int is_any_device)
                            handle->linktype != DLT_NETLINK)
                                handle->linktype = DLT_LINUX_SLL;
                        if (handle->linktype == -1) {
-                               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                    "unknown arptype %d, defaulting to cooked mode",
                                    arptype);
                                status = PCAP_WARNING;
@@ -4137,7 +4137,7 @@ activate_new(pcap_t *handle, int is_any_device)
                int nsec_tstamps = 1;
 
                if (setsockopt(sock_fd, SOL_SOCKET, SO_TIMESTAMPNS, &nsec_tstamps, sizeof(nsec_tstamps)) < 0) {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "setsockopt: unable to set SO_TIMESTAMPNS");
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "setsockopt: unable to set SO_TIMESTAMPNS");
                        close(sock_fd);
                        return PCAP_ERROR;
                }
@@ -4722,7 +4722,7 @@ create_ring(pcap_t *handle, int *status)
                break;
 #endif
        default:
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "Internal error: unknown TPACKET_ value %u",
                    handlep->tp_version);
                *status = PCAP_ERROR;
@@ -5135,7 +5135,7 @@ static int pcap_wait_for_frames_mmap(pcap_t *handle)
                         * the descriptor.
                         */
                        if (pollinfo[0].revents & (POLLHUP | POLLRDHUP)) {
-                               pcap_snprintf(handle->errbuf,
+                               snprintf(handle->errbuf,
                                        PCAP_ERRBUF_SIZE,
                                        "Hangup on packet socket");
                                return PCAP_ERROR;
@@ -5159,7 +5159,7 @@ static int pcap_wait_for_frames_mmap(pcap_t *handle)
                                         * pcap_dispatch() etc. aren't
                                         * defined to return that.
                                         */
-                                       pcap_snprintf(handle->errbuf,
+                                       snprintf(handle->errbuf,
                                                PCAP_ERRBUF_SIZE,
                                                "The interface went down");
                                } else {
@@ -5170,7 +5170,7 @@ static int pcap_wait_for_frames_mmap(pcap_t *handle)
                                return PCAP_ERROR;
                        }
                        if (pollinfo[0].revents & POLLNVAL) {
-                               pcap_snprintf(handle->errbuf,
+                               snprintf(handle->errbuf,
                                        PCAP_ERRBUF_SIZE,
                                        "Invalid polling request on packet socket");
                                return PCAP_ERROR;
@@ -5221,7 +5221,7 @@ static int pcap_handle_packet_mmap(
                 * Report some system information as a debugging aid.
                 */
                if (uname(&utsname) != -1) {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                "corrupted frame on kernel ring mac "
                                "offset %u + caplen %u > frame len %d "
                                "(kernel %.32s version %s, machine %.16s)",
@@ -5229,7 +5229,7 @@ static int pcap_handle_packet_mmap(
                                utsname.release, utsname.version,
                                utsname.machine);
                } else {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                "corrupted frame on kernel ring mac "
                                "offset %u + caplen %u > frame len %d",
                                tp_mac, tp_snaplen, handle->bufsize);
@@ -5273,7 +5273,7 @@ static int pcap_handle_packet_mmap(
                        if (bp < (u_char *)frame +
                                           TPACKET_ALIGN(handlep->tp_hdrlen) +
                                           sizeof(struct sockaddr_ll)) {
-                               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                        "cooked-mode frame doesn't have room for sll header");
                                return -1;
                        }
@@ -5313,7 +5313,7 @@ static int pcap_handle_packet_mmap(
                        if (bp < (u_char *)frame +
                                           TPACKET_ALIGN(handlep->tp_hdrlen) +
                                           sizeof(struct sockaddr_ll)) {
-                               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                        "cooked-mode frame doesn't have room for sll header");
                                return -1;
                        }
@@ -6116,7 +6116,7 @@ enter_rfmon_mode_wext(pcap_t *handle, int sock_fd, const char *device)
        ireq.u.data.length = 0;
        ireq.u.data.flags = 0;
        if (ioctl(sock_fd, SIOCGIWPRIV, &ireq) != -1) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: SIOCGIWPRIV with a zero-length buffer didn't fail!",
                    device);
                return PCAP_ERROR;
@@ -7053,7 +7053,7 @@ iface_dsa_get_proto_info(const char *device, pcap_t *handle)
                }
        }
 
-       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                      "unsupported DSA tag: %s", buf);
 
        return PCAP_ERROR;
@@ -7133,7 +7133,7 @@ activate_old(pcap_t *handle, int is_any_device)
         */
        map_arphrd_to_dlt(handle, handle->fd, arptype, device, 0);
        if (handle->linktype == -1) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                         "unknown arptype %d", arptype);
                return PCAP_ERROR;
        }
index 486397063efa396e78a1c9ae925a8314ad3d9979..39a463d0009a962758e4017a5bed4b70b060fb42 100644 (file)
@@ -168,7 +168,7 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c
                }
 
                if (nlh->nlmsg_len < sizeof(struct nlmsghdr) || (u_int)len < nlh->nlmsg_len) {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Message truncated: (got: %zd) (nlmsg_len: %u)", len, nlh->nlmsg_len);
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Message truncated: (got: %zd) (nlmsg_len: %u)", len, nlh->nlmsg_len);
                        return -1;
                }
 
@@ -190,7 +190,7 @@ netfilter_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_c
                                const struct nfattr *payload_attr = NULL;
 
                                if (nlh->nlmsg_len < HDR_LENGTH) {
-                                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Malformed message: (nlmsg_len: %u)", nlh->nlmsg_len);
+                                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "Malformed message: (nlmsg_len: %u)", nlh->nlmsg_len);
                                        return -1;
                                }
 
@@ -301,7 +301,7 @@ netfilter_stats_linux(pcap_t *handle, struct pcap_stat *stats)
 static int
 netfilter_inject_linux(pcap_t *handle, const void *buf _U_, int size _U_)
 {
-       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
            "Packet injection is not supported on netfilter devices");
        return (-1);
 }
@@ -513,7 +513,7 @@ netfilter_activate(pcap_t* handle)
                        char *end_dev;
 
                        if (group_count == 32) {
-                               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                                "Maximum 32 netfilter groups! dev: %s",
                                                handle->opt.device);
                                return PCAP_ERROR;
@@ -522,7 +522,7 @@ netfilter_activate(pcap_t* handle)
                        group_id = strtol(dev, &end_dev, 0);
                        if (end_dev != dev) {
                                if (group_id < 0 || group_id > 65535) {
-                                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                                        "Netfilter group range from 0 to 65535 (got %ld)",
                                                        group_id);
                                        return PCAP_ERROR;
@@ -538,7 +538,7 @@ netfilter_activate(pcap_t* handle)
        }
 
        if (type == OTHER || *dev) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                "Can't get netfilter group(s) index from %s",
                                handle->opt.device);
                return PCAP_ERROR;
index e61cf6ab2e9bac47e6bcc179836389a18e926723..7c006595c3f11a6b90b243ca028ec409f0a0a32f 100644 (file)
@@ -88,7 +88,7 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t
 
        if (strlen(source) > PCAP_BUF_SIZE)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "The source string is too long. Cannot handle it correctly.");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "The source string is too long. Cannot handle it correctly.");
                return -1;
        }
 
@@ -119,7 +119,7 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t
 
                if (*alldevs == NULL)
                {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                "No interfaces found! Make sure libpcap/Npcap is properly installed"
                                " on the local machine.");
                        return -1;
@@ -209,7 +209,7 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t
                }
 
                /* Save the path for future reference */
-               pcap_snprintf(path, sizeof(path), "%s", name);
+               snprintf(path, sizeof(path), "%s", name);
                pathlen = strlen(path);
 
 #ifdef _WIN32
@@ -224,7 +224,7 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t
 
                if (filehandle == INVALID_HANDLE_VALUE)
                {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' exist?", path);
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' exist?", path);
                        return -1;
                }
 
@@ -237,7 +237,7 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t
 
                if (filedata == NULL)
                {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' exist?", path);
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error when listing files: does folder '%s' exist?", path);
                        return -1;
                }
 #endif
@@ -249,11 +249,11 @@ int pcap_findalldevs_ex(const char *source, struct pcap_rmtauth *auth, pcap_if_t
                        /* Skip the file if the pathname won't fit in the buffer */
                        if (pathlen + strlen(filedata.cFileName) >= sizeof(filename))
                                continue;
-                       pcap_snprintf(filename, sizeof(filename), "%s%s", path, filedata.cFileName);
+                       snprintf(filename, sizeof(filename), "%s%s", path, filedata.cFileName);
 #else
                        if (pathlen + strlen(filedata->d_name) >= sizeof(filename))
                                continue;
-                       pcap_snprintf(filename, sizeof(filename), "%s%s", path, filedata->d_name);
+                       snprintf(filename, sizeof(filename), "%s%s", path, filedata->d_name);
 #endif
 
                        fp = pcap_open_offline(filename, errbuf);
@@ -370,7 +370,7 @@ pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout,
 
        if (strlen(source) > PCAP_BUF_SIZE)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "The source string is too long. Cannot handle it correctly.");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "The source string is too long. Cannot handle it correctly.");
                return NULL;
        }
 
@@ -445,15 +445,15 @@ pcap_t *pcap_open(const char *source, int snaplen, int flags, int read_timeout,
 
 fail:
        if (status == PCAP_ERROR)
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
                    name, fp->errbuf);
        else if (status == PCAP_ERROR_NO_SUCH_DEVICE ||
            status == PCAP_ERROR_PERM_DENIED ||
            status == PCAP_ERROR_PROMISC_PERM_DENIED)
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%s)",
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%s)",
                    name, pcap_statustostr(status), fp->errbuf);
        else
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s",
                    name, pcap_statustostr(status));
        pcap_close(fp);
        return NULL;
index e969359414eed05bbcfd7a43051c5ccf48472e2b..348805d18cc0809553d773a3081b595b700ada73 100644 (file)
@@ -168,7 +168,7 @@ pcap_read_nit(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                        continue;
 
                default:
-                       pcap_snprintf(p->errbuf, sizeof(p->errbuf),
+                       snprintf(p->errbuf, sizeof(p->errbuf),
                            "bad nit state %d", nh->nh_state);
                        return (-1);
                }
index 09969f3d83216e620f8fc7316d6fe74233eff3c8..ba9a58beec13f35cda9c52262ae81acb8d805c94 100644 (file)
@@ -155,7 +155,7 @@ oid_get_request(ADAPTER *adapter, bpf_u_int32 oid, void *data, size_t *lenp,
         */
        oid_data_arg = malloc(sizeof (PACKET_OID_DATA) + *lenp);
        if (oid_data_arg == NULL) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "Couldn't allocate argument buffer for PacketRequest");
                return (PCAP_ERROR);
        }
@@ -283,7 +283,7 @@ pcap_setbuff_npf(pcap_t *p, int dim)
 
        if(PacketSetBuff(pw->adapter,dim)==FALSE)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: not enough memory to allocate the kernel buffer");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: not enough memory to allocate the kernel buffer");
                return (-1);
        }
        return (0);
@@ -297,7 +297,7 @@ pcap_setmode_npf(pcap_t *p, int mode)
 
        if(PacketSetMode(pw->adapter,mode)==FALSE)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: working mode not recognized");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: working mode not recognized");
                return (-1);
        }
 
@@ -312,7 +312,7 @@ pcap_setmintocopy_npf(pcap_t *p, int size)
 
        if(PacketSetMinToCopy(pw->adapter, size)==FALSE)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: unable to set the requested mintocopy size");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: unable to set the requested mintocopy size");
                return (-1);
        }
        return (0);
@@ -350,7 +350,7 @@ pcap_oid_set_request_npf(pcap_t *p, bpf_u_int32 oid, const void *data,
         */
        oid_data_arg = malloc(sizeof (PACKET_OID_DATA) + *lenp);
        if (oid_data_arg == NULL) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Couldn't allocate argument buffer for PacketRequest");
                return (PCAP_ERROR);
        }
@@ -384,7 +384,7 @@ pcap_sendqueue_transmit_npf(pcap_t *p, pcap_send_queue *queue, int sync)
        u_int res;
 
        if (pw->adapter==NULL) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Cannot transmit a queue to an offline capture or to a TurboCap port");
                return (0);
        }
@@ -409,7 +409,7 @@ pcap_setuserbuffer_npf(pcap_t *p, int size)
 
        if (size<=0) {
                /* Bogus parameter */
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Error: invalid size %d",size);
                return (-1);
        }
@@ -418,7 +418,7 @@ pcap_setuserbuffer_npf(pcap_t *p, int size)
        new_buff=(unsigned char*)malloc(sizeof(char)*size);
 
        if (!new_buff) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Error: not enough memory");
                return (-1);
        }
@@ -440,7 +440,7 @@ pcap_live_dump_npf(pcap_t *p, char *filename, int maxsize, int maxpacks)
        /* Set the packet driver in dump mode */
        res = PacketSetMode(pw->adapter, PACKET_MODE_DUMP);
        if(res == FALSE){
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Error setting dump mode");
                return (-1);
        }
@@ -448,7 +448,7 @@ pcap_live_dump_npf(pcap_t *p, char *filename, int maxsize, int maxpacks)
        /* Set the name of the dump file */
        res = PacketSetDumpName(pw->adapter, filename, (int)strlen(filename));
        if(res == FALSE){
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Error setting kernel dump file name");
                return (-1);
        }
@@ -456,7 +456,7 @@ pcap_live_dump_npf(pcap_t *p, char *filename, int maxsize, int maxpacks)
        /* Set the limits of the dump file */
        res = PacketSetDumpLimits(pw->adapter, maxsize, maxpacks);
        if(res == FALSE) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                "Error setting dump limit");
                return (-1);
        }
@@ -544,7 +544,7 @@ pcap_read_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                                 * documented as having error returns
                                 * other than PCAP_ERROR or PCAP_ERROR_BREAK.
                                 */
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "The interface disappeared");
                        } else {
                                pcap_fmt_errmsg_for_win32_err(p->errbuf,
@@ -706,7 +706,7 @@ pcap_read_win32_dag(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                 */
                PacketInitPacket(&Packet, (BYTE *)p->buffer, p->bufsize);
                if (!PacketReceivePacket(pw->adapter, &Packet, TRUE)) {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error: PacketReceivePacket failed");
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error: PacketReceivePacket failed");
                        return (-1);
                }
 
@@ -855,7 +855,7 @@ pcap_inject_npf(pcap_t *p, const void *buf, int size)
 
        PacketInitPacket(&pkt, (PVOID)buf, size);
        if(PacketSendPacket(pw->adapter,&pkt,TRUE) == FALSE) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: PacketSendPacket failed");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: PacketSendPacket failed");
                return (-1);
        }
 
@@ -1063,7 +1063,7 @@ pcap_activate_npf(pcap_t *p)
                 * some programs will report the warning.
                 */
                p->linktype = DLT_EN10MB;
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Unknown NdisMedium value %d, defaulting to DLT_EN10MB",
                    type.LinkType);
                status = PCAP_WARNING;
@@ -1087,7 +1087,7 @@ pcap_activate_npf(pcap_t *p)
 
                if (PacketSetHwFilter(pw->adapter,NDIS_PACKET_TYPE_PROMISCUOUS) == FALSE)
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "failed to set hardware filter to promiscuous mode");
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "failed to set hardware filter to promiscuous mode");
                        goto bad;
                }
        }
@@ -1105,7 +1105,7 @@ pcap_activate_npf(pcap_t *p)
                        NDIS_PACKET_TYPE_BROADCAST |
                        NDIS_PACKET_TYPE_MULTICAST) == FALSE)
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "failed to set hardware filter to non-promiscuous mode");
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "failed to set hardware filter to non-promiscuous mode");
                        goto bad;
                }
        }
@@ -1127,7 +1127,7 @@ pcap_activate_npf(pcap_t *p)
 
                if(PacketSetBuff(pw->adapter,p->opt.buffer_size)==FALSE)
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: not enough memory to allocate the kernel buffer");
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "driver error: not enough memory to allocate the kernel buffer");
                        goto bad;
                }
 
@@ -1176,7 +1176,7 @@ pcap_activate_npf(pcap_t *p)
                int             postype = 0;
                char    keyname[512];
 
-               pcap_snprintf(keyname, sizeof(keyname), "%s\\CardParams\\%s",
+               snprintf(keyname, sizeof(keyname), "%s\\CardParams\\%s",
                        "SYSTEM\\CurrentControlSet\\Services\\DAG",
                        strstr(_strlwr(p->opt.device), "dag"));
                do
@@ -1222,7 +1222,7 @@ pcap_activate_npf(pcap_t *p)
        {
                if (!PacketSetLoopbackBehavior(pw->adapter, NPF_DISABLE_LOOPBACK))
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "Unable to disable the capture of loopback packets.");
                        goto bad;
                }
@@ -1776,7 +1776,7 @@ pcap_platform_finddevs(pcap_if_list_t *devlistp, char *errbuf)
        AdaptersName = (char*) malloc(NameLength);
        if (AdaptersName == NULL)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Cannot allocate enough memory to list the adapters.");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Cannot allocate enough memory to list the adapters.");
                return (-1);
        }
 
@@ -1906,7 +1906,7 @@ pcap_lookupdev(char *errbuf)
 
                if(TAdaptersName == NULL)
                {
-                       (void)pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "memory allocation failure");
+                       (void)snprintf(errbuf, PCAP_ERRBUF_SIZE, "memory allocation failure");
                        return NULL;
                }
 
index 8e1febdc1a32ac05d315a9402588a22222f70853..db6a8cad0cf3641ab15ceb622b10d3919434fb50 100644 (file)
--- a/pcap-pf.c
+++ b/pcap-pf.c
@@ -158,7 +158,7 @@ pcap_read_pf(pcap_t *pc, int cnt, pcap_handler callback, u_char *user)
                        }
                }
                if (cc < sizeof(*sp)) {
-                       pcap_snprintf(pc->errbuf, sizeof(pc->errbuf),
+                       snprintf(pc->errbuf, sizeof(pc->errbuf),
                            "pf short read (%d)", cc);
                        return (-1);
                }
@@ -168,7 +168,7 @@ pcap_read_pf(pcap_t *pc, int cnt, pcap_handler callback, u_char *user)
                } else
                        sp = (struct enstamp *)bp;
                if (sp->ens_stamplen != sizeof(*sp)) {
-                       pcap_snprintf(pc->errbuf, sizeof(pc->errbuf),
+                       snprintf(pc->errbuf, sizeof(pc->errbuf),
                            "pf short stamplen (%d)",
                            sp->ens_stamplen);
                        return (-1);
@@ -327,7 +327,7 @@ pcap_activate_pf(pcap_t *p)
                p->fd = pfopen(p->opt.device, O_RDONLY);
        if (p->fd < 0) {
                if (errno == EACCES) {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "pf open: %s: Permission denied\n"
 "your system may not be properly configured; see the packetfilter(4) man page",
                            p->opt.device);
@@ -460,7 +460,7 @@ pcap_activate_pf(pcap_t *p)
                 * framing", there's not much we can do, as that
                 * doesn't specify a particular type of header.
                 */
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "unknown data-link type %u", devparams.end_dev_type);
                err = PCAP_ERROR;
                goto bad;
index f154de3f25e33116bca1592d981003eb2b7897c0..3a10c6d5fefea1a7a71c1903fba8bd4712c0b3c9 100644 (file)
@@ -197,21 +197,21 @@ rdmasniff_activate(pcap_t *handle)
 
        priv->context = ibv_open_device(priv->rdma_device);
        if (!priv->context) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to open device %s", handle->opt.device);
                goto error;
        }
 
        priv->pd = ibv_alloc_pd(priv->context);
        if (!priv->pd) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to alloc PD for device %s", handle->opt.device);
                goto error;
        }
 
        priv->channel = ibv_create_comp_channel(priv->context);
        if (!priv->channel) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to create comp channel for device %s", handle->opt.device);
                goto error;
        }
@@ -219,7 +219,7 @@ rdmasniff_activate(pcap_t *handle)
        priv->cq = ibv_create_cq(priv->context, RDMASNIFF_NUM_RECEIVES,
                                 NULL, priv->channel, 0);
        if (!priv->cq) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to create CQ for device %s", handle->opt.device);
                goto error;
        }
@@ -233,7 +233,7 @@ rdmasniff_activate(pcap_t *handle)
        qp_init_attr.qp_type = IBV_QPT_RAW_PACKET;
        priv->qp = ibv_create_qp(priv->pd, &qp_init_attr);
        if (!priv->qp) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to create QP for device %s", handle->opt.device);
                goto error;
        }
@@ -242,7 +242,7 @@ rdmasniff_activate(pcap_t *handle)
        qp_attr.qp_state = IBV_QPS_INIT;
        qp_attr.port_num = priv->port_num;
        if (ibv_modify_qp(priv->qp, &qp_attr, IBV_QP_STATE | IBV_QP_PORT)) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to modify QP to INIT for device %s", handle->opt.device);
                goto error;
        }
@@ -250,7 +250,7 @@ rdmasniff_activate(pcap_t *handle)
        memset(&qp_attr, 0, sizeof qp_attr);
        qp_attr.qp_state = IBV_QPS_RTR;
        if (ibv_modify_qp(priv->qp, &qp_attr, IBV_QP_STATE)) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to modify QP to RTR for device %s", handle->opt.device);
                goto error;
        }
@@ -261,7 +261,7 @@ rdmasniff_activate(pcap_t *handle)
        flow_attr.port = priv->port_num;
        priv->flow = ibv_create_flow(priv->qp, &flow_attr);
        if (!priv->flow) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to create flow for device %s", handle->opt.device);
                goto error;
        }
@@ -269,21 +269,21 @@ rdmasniff_activate(pcap_t *handle)
        handle->bufsize = RDMASNIFF_NUM_RECEIVES * RDMASNIFF_RECEIVE_SIZE;
        handle->buffer = malloc(handle->bufsize);
        if (!handle->buffer) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to allocate receive buffer for device %s", handle->opt.device);
                goto error;
        }
 
        priv->oneshot_buffer = malloc(RDMASNIFF_RECEIVE_SIZE);
        if (!priv->oneshot_buffer) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to allocate oneshot buffer for device %s", handle->opt.device);
                goto error;
        }
 
        priv->mr = ibv_reg_mr(priv->pd, handle->buffer, handle->bufsize, IBV_ACCESS_LOCAL_WRITE);
        if (!priv->mr) {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                              "Failed to register MR for device %s", handle->opt.device);
                goto error;
        }
index 09a3956f7a8df548da7b752c5a4415376646ddac..3cb75afb87ce479ed10aca000402e67d5dc18b9f 100644 (file)
@@ -461,7 +461,7 @@ static int pcap_read_nocb_remote(pcap_t *p, struct pcap_pkthdr *pkt_header, u_ch
                        /*
                         * Message is shorter than an rpcap header.
                         */
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "UDP packet message is shorter than an rpcap header");
                        return -1;
                }
@@ -472,7 +472,7 @@ static int pcap_read_nocb_remote(pcap_t *p, struct pcap_pkthdr *pkt_header, u_ch
                         * Message is shorter than the header claims it
                         * is.
                         */
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "UDP packet message is shorter than its rpcap header claims");
                        return -1;
                }
@@ -516,7 +516,7 @@ static int pcap_read_nocb_remote(pcap_t *p, struct pcap_pkthdr *pkt_header, u_ch
                         * subtracting in order to avoid an
                         * overflow.)
                         */
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "Server sent us a message larger than the largest expected packet message");
                        return -1;
                }
@@ -565,7 +565,7 @@ static int pcap_read_nocb_remote(pcap_t *p, struct pcap_pkthdr *pkt_header, u_ch
 
        if (ntohl(net_pkt_header->caplen) > plen)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Packet's captured data goes past the end of the received packet message.");
                return -1;
        }
@@ -886,7 +886,7 @@ static struct pcap_stat *rpcap_stats_rpcap(pcap_t *p, struct pcap_stat *ps, int
        if (mode != PCAP_STATS_STANDARD)
 #endif
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Invalid stats mode %d", mode);
                return NULL;
        }
@@ -998,7 +998,7 @@ rpcap_remoteact_getsock(const char *host, int *error, char *errbuf)
        retval = getaddrinfo(host, "0", &hints, &addrinfo);
        if (retval != 0)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "getaddrinfo() %s",
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "getaddrinfo() %s",
                    gai_strerror(retval));
                *error = 1;
                return NULL;
@@ -1253,7 +1253,7 @@ static int pcap_startcapture_remote(pcap_t *fp)
                        memset(&hints, 0, sizeof(struct addrinfo));
                        hints.ai_family = ai_family;            /* Use the same address family of the control socket */
                        hints.ai_socktype = (pr->rmt_flags & PCAP_OPENFLAG_DATATX_UDP) ? SOCK_DGRAM : SOCK_STREAM;
-                       pcap_snprintf(portdata, PCAP_BUF_SIZE, "%d", ntohs(startcapreply.portdata));
+                       snprintf(portdata, PCAP_BUF_SIZE, "%d", ntohs(startcapreply.portdata));
 
                        /* Let's the server pick up a free network port for us */
                        if (sock_initaddress(host, portdata, &hints, &addrinfo, fp->errbuf, PCAP_ERRBUF_SIZE) == -1)
@@ -1743,7 +1743,7 @@ static int pcap_createfilter_norpcappkt(pcap_t *fp, struct bpf_program *prog)
                            mydataport) == -1)
                        {
                                /* Failed. */
-                               pcap_snprintf(fp->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(fp->errbuf, PCAP_ERRBUF_SIZE,
                                    "Can't allocate memory for new filter");
                                return -1;
                        }
@@ -1760,7 +1760,7 @@ static int pcap_createfilter_norpcappkt(pcap_t *fp, struct bpf_program *prog)
                            myaddress, peeraddress, mydataport) == -1)
                        {
                                /* Failed. */
-                               pcap_snprintf(fp->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(fp->errbuf, PCAP_ERRBUF_SIZE,
                                    "Can't allocate memory for new filter");
                                return -1;
                        }
@@ -1816,12 +1816,12 @@ static int pcap_setsampling_remote(pcap_t *fp)
         * that do fit into the message.
         */
        if (fp->rmt_samp.method < 0 || fp->rmt_samp.method > 255) {
-               pcap_snprintf(fp->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(fp->errbuf, PCAP_ERRBUF_SIZE,
                    "Invalid sampling method %d", fp->rmt_samp.method);
                return -1;
        }
        if (fp->rmt_samp.value < 0 || fp->rmt_samp.value > 65535) {
-               pcap_snprintf(fp->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(fp->errbuf, PCAP_ERRBUF_SIZE,
                    "Invalid sampling value %d", fp->rmt_samp.value);
                return -1;
        }
@@ -1930,7 +1930,7 @@ static int rpcap_doauth(SOCKET sockctrl, SSL *ssl, uint8 *ver, struct pcap_rmtau
                                str_length = strlen(auth->username);
                                if (str_length > 65535)
                                {
-                                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "User name is too long (> 65535 bytes)");
+                                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "User name is too long (> 65535 bytes)");
                                        return -1;
                                }
                                length += (uint16)str_length;
@@ -1940,7 +1940,7 @@ static int rpcap_doauth(SOCKET sockctrl, SSL *ssl, uint8 *ver, struct pcap_rmtau
                                str_length = strlen(auth->password);
                                if (str_length > 65535)
                                {
-                                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Password is too long (> 65535 bytes)");
+                                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "Password is too long (> 65535 bytes)");
                                        return -1;
                                }
                                length += (uint16)str_length;
@@ -1948,7 +1948,7 @@ static int rpcap_doauth(SOCKET sockctrl, SSL *ssl, uint8 *ver, struct pcap_rmtau
                        break;
 
                default:
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Authentication type not recognized.");
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "Authentication type not recognized.");
                        return -1;
                }
 
@@ -2047,7 +2047,7 @@ static int rpcap_doauth(SOCKET sockctrl, SSL *ssl, uint8 *ver, struct pcap_rmtau
                        /*
                         * Bogus - give up on this server.
                         */
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "The server's minimum supported protocol version is greater than its maximum supported protocol version");
                        return -1;
                }
@@ -2096,7 +2096,7 @@ novers:
        /*
         * There is no version we both support; that is a fatal error.
         */
-       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(errbuf, PCAP_ERRBUF_SIZE,
            "The server doesn't support any protocol version that we support");
        return -1;
 }
@@ -2105,7 +2105,7 @@ novers:
 static int
 pcap_getnonblock_rpcap(pcap_t *p)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Non-blocking mode isn't supported for capturing remotely with rpcap");
        return (-1);
 }
@@ -2113,7 +2113,7 @@ pcap_getnonblock_rpcap(pcap_t *p)
 static int
 pcap_setnonblock_rpcap(pcap_t *p, int nonblock _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Non-blocking mode isn't supported for capturing remotely with rpcap");
        return (-1);
 }
@@ -2142,7 +2142,7 @@ rpcap_setup_session(const char *source, struct pcap_rmtauth *auth,
         */
        if (type != PCAP_SRC_IFREMOTE)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "Non-remote interface passed to remote capture routine");
                return -1;
        }
@@ -2154,7 +2154,7 @@ rpcap_setup_session(const char *source, struct pcap_rmtauth *auth,
         */
        if (*uses_sslp && (rmt_flags & PCAP_OPENFLAG_DATATX_UDP))
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "TLS not supported with UDP forward of remote packets");
                return -1;
        }
@@ -2231,7 +2231,7 @@ rpcap_setup_session(const char *source, struct pcap_rmtauth *auth,
                                return -1;
                        }
 #else
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "No TLS support");
                        sock_close(*sockctrlp, NULL, 0);
                        return -1;
@@ -2570,7 +2570,7 @@ pcap_findalldevs_ex_remote(const char *source, struct pcap_rmtauth *auth, pcap_i
 
                        if (findalldevs_if.namelen >= sizeof(tmpstring))
                        {
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Interface name too long");
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Interface name too long");
                                goto error;
                        }
 
@@ -2599,7 +2599,7 @@ pcap_findalldevs_ex_remote(const char *source, struct pcap_rmtauth *auth, pcap_i
                {
                        if (findalldevs_if.desclen >= sizeof(tmpstring))
                        {
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Interface description too long");
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Interface description too long");
                                goto error;
                        }
 
@@ -2851,7 +2851,7 @@ SOCKET pcap_remoteact_accept_ex(const char *address, const char *port, const cha
                        return (SOCKET)-1;
                }
 #else
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "No TLS support");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "No TLS support");
                sock_close(sockctrl, NULL, 0);
                return (SOCKET)-1;
 #endif
@@ -2986,7 +2986,7 @@ int pcap_remoteact_close(const char *host, char *errbuf)
        retval = getaddrinfo(host, "0", &hints, &addrinfo);
        if (retval != 0)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "getaddrinfo() %s", gai_strerror(retval));
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "getaddrinfo() %s", gai_strerror(retval));
                return -1;
        }
 
@@ -3079,7 +3079,7 @@ int pcap_remoteact_close(const char *host, char *errbuf)
        /* To avoid inconsistencies in the number of sock_init() */
        sock_cleanup();
 
-       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "The host you want to close the active connection is not known");
+       snprintf(errbuf, PCAP_ERRBUF_SIZE, "The host you want to close the active connection is not known");
        return -1;
 }
 
@@ -3134,7 +3134,7 @@ int pcap_remoteact_list(char *hostlist, char sep, int size, char *errbuf)
 
                if ((size < 0) || (len >= (size_t)size))
                {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "The string you provided is not able to keep "
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "The string you provided is not able to keep "
                                "the hostnames for all the active connections");
                        return -1;
                }
@@ -3190,7 +3190,7 @@ static int rpcap_check_msg_ver(SOCKET sock, SSL *ssl, uint8 expected_ver, struct
                 */
                if (errbuf != NULL)
                {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "Server sent us a message with version %u when we were expecting %u",
                            header->ver, expected_ver);
                }
@@ -3250,17 +3250,17 @@ static int rpcap_check_msg_type(SOCKET sock, SSL *ssl, uint8 request_type, struc
                        if (request_type_string == NULL)
                        {
                                /* This should not happen. */
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "rpcap_check_msg_type called for request message with type %u",
                                    request_type);
                                return -1;
                        }
                        if (msg_type_string != NULL)
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "%s message received in response to a %s message",
                                    msg_type_string, request_type_string);
                        else
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "Message of unknown type %u message received in response to a %s request",
                                    header->type, request_type_string);
                }
@@ -3312,7 +3312,7 @@ static int rpcap_recv(SOCKET sock, SSL *ssl, void *buffer, size_t toread, uint32
        if (toread > *plen)
        {
                /* The server sent us a bad message */
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Message payload is too short");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Message payload is too short");
                return -1;
        }
        nread = sock_recv(sock, ssl, buffer, toread,
@@ -3343,7 +3343,7 @@ static void rpcap_msg_err(SOCKET sockctrl, SSL *ssl, uint32 plen, char *remote_e
                    PCAP_ERRBUF_SIZE) == -1)
                {
                        // Network error.
-                       pcap_snprintf(remote_errbuf, PCAP_ERRBUF_SIZE, "Read of error message from client failed: %s", errbuf);
+                       snprintf(remote_errbuf, PCAP_ERRBUF_SIZE, "Read of error message from client failed: %s", errbuf);
                        return;
                }
 
@@ -3369,7 +3369,7 @@ static void rpcap_msg_err(SOCKET sockctrl, SSL *ssl, uint32 plen, char *remote_e
                    PCAP_ERRBUF_SIZE) == -1)
                {
                        // Network error.
-                       pcap_snprintf(remote_errbuf, PCAP_ERRBUF_SIZE, "Read of error message from client failed: %s", errbuf);
+                       snprintf(remote_errbuf, PCAP_ERRBUF_SIZE, "Read of error message from client failed: %s", errbuf);
                        return;
                }
 
@@ -3454,7 +3454,7 @@ static int rpcap_read_packet_msg(struct pcap_rpcap const *rp, pcap_t *p, size_t
                         * Update the read pointer and byte count, and
                         * return an error indication.
                         */
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "The server terminated the connection.");
                        return -1;
                }
index 00b3562ebddce7d9ffa1e52029004e5a58d75d3c..ee42e05f57f24b1c370e53ec05eafb207f0c7b4a 100644 (file)
@@ -315,7 +315,7 @@ pcap_platform_finddevs(pcap_if_list_t *devlistp, char *errbuf)
 pcap_t *
 pcap_create_interface(const char *device, char *errbuf)
 {
-  pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+  snprintf(errbuf, PCAP_ERRBUF_SIZE,
                 "This version of libpcap only supports Septel cards");
   return (NULL);
 }
index a12aa5a399b86a9a271251e48dac5d6f561a6f9f..97280c39666b9ce1e416d67c9602ad2fd4dd896b 100644 (file)
@@ -266,7 +266,7 @@ int acn_parse_hosts_file(char *errbuf) {                            /* returns: -1 = error, 0 = OK */
 
        empty_unit_table();
        if ((fp = fopen("/etc/hosts", "r")) == NULL) {                                                                          /* try to open the hosts file and if it fails */
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Cannot open '/etc/hosts' for reading.");       /* return the nohostsfile error response */
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Cannot open '/etc/hosts' for reading.");    /* return the nohostsfile error response */
                return -1;
        }
        while (fgets(buf, MAX_LINE_SIZE-1, fp)) {                       /* while looping over the file */
@@ -289,7 +289,7 @@ int acn_parse_hosts_file(char *errbuf) {                            /* returns: -1 = error, 0 = OK */
                geoslot = *(ptr2 + 5) - '0';                                    /* and geo-slot number */
                if (chassis < 1 || chassis > MAX_CHASSIS ||
                        geoslot < 1 || geoslot > MAX_GEOSLOT) {         /* if the chassis and/or slot numbers appear to be bad... */
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Invalid ACN name in '/etc/hosts'.");   /* warn the user */
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "Invalid ACN name in '/etc/hosts'.");        /* warn the user */
                        continue;                                                                                                                                       /* and ignore the entry */
                }
                if ((ptr2 = (char *)malloc(strlen(ptr) + 1)) == NULL) {
@@ -407,14 +407,14 @@ static void acn_freealldevs(void) {
 
 static void nonUnified_IOP_port_name(char *buf, size_t bufsize, const char *proto, unit_t *u) {
 
-       pcap_snprintf(buf, bufsize, "%s_%d_%d", proto, u->chassis, u->geoslot);
+       snprintf(buf, bufsize, "%s_%d_%d", proto, u->chassis, u->geoslot);
 }
 
 static void unified_IOP_port_name(char *buf, size_t bufsize, const char *proto, unit_t *u, int IOPportnum) {
        int                     portnum;
 
        portnum = ((u->chassis - 1) * 64) + ((u->geoslot - 1) * 8) + IOPportnum + 1;
-       pcap_snprintf(buf, bufsize, "%s_%d", proto, portnum);
+       snprintf(buf, bufsize, "%s_%d", proto, portnum);
 }
 
 static char *translate_IOP_to_pcap_name(unit_t *u, char *IOPname, bpf_u_int32 iftype) {
@@ -916,7 +916,7 @@ static int pcap_setfilter_acn(pcap_t *handle, struct bpf_program *bpf) {
 }
 
 static int pcap_setdirection_acn(pcap_t *handle, pcap_direction_t d) {
-       pcap_snprintf(handle->errbuf, sizeof(handle->errbuf),
+       snprintf(handle->errbuf, sizeof(handle->errbuf),
            "Setting direction is not supported on ACN adapters");
        return -1;
 }
index 5f2e950dd37c06ef2a49af4cd2766b20ef80c3dc..dd28fa9a66754469f48d43476787ffa171438bb7 100644 (file)
@@ -234,7 +234,7 @@ snf_activate(pcap_t* p)
        int flags = -1, ring_id = -1;
 
        if (device == NULL) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "device is NULL");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "device is NULL");
                return -1;
        }
 
@@ -336,7 +336,7 @@ snf_findalldevs(pcap_if_list_t *devlistp, char *errbuf)
        const char *nr = NULL;
 
        if (snf_init(SNF_VERSION_API)) {
-               (void)pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "snf_getifaddrs: snf_init failed");
                return (-1);
        }
@@ -351,7 +351,7 @@ snf_findalldevs(pcap_if_list_t *devlistp, char *errbuf)
                errno = 0;
                merge = strtol(nr, NULL, 0);
                if (errno) {
-                       (void)pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                "snf_getifaddrs: SNF_FLAGS is not a valid number");
                        return (-1);
                }
@@ -389,7 +389,7 @@ snf_findalldevs(pcap_if_list_t *devlistp, char *errbuf)
                 * entry for the device, if they're not already in the
                 * list of IP addresses for the device?
                 */
-               (void)pcap_snprintf(desc,MAX_DESC_LENGTH,"Myricom %ssnf%d",
+               (void)snprintf(desc,MAX_DESC_LENGTH,"Myricom %ssnf%d",
                        merge ? "Merge Bitmask Port " : "",
                        merge ? 1 << ifa->snf_ifa_portnum : ifa->snf_ifa_portnum);
                /*
@@ -465,8 +465,8 @@ snf_findalldevs(pcap_if_list_t *devlistp, char *errbuf)
                /*
                 * Add a new entry with all ports bitmask
                 */
-               (void)pcap_snprintf(name,MAX_DESC_LENGTH,"snf%d",allports);
-               (void)pcap_snprintf(desc,MAX_DESC_LENGTH,"Myricom Merge Bitmask All Ports snf%d",
+               (void)snprintf(name,MAX_DESC_LENGTH,"snf%d",allports);
+               (void)snprintf(desc,MAX_DESC_LENGTH,"Myricom Merge Bitmask All Ports snf%d",
                        allports);
                /*
                 * XXX - is there any notion of "up" and "running" that
@@ -586,7 +586,7 @@ pcap_platform_finddevs(pcap_if_list_t *devlistp, char *errbuf)
 pcap_t *
 pcap_create_interface(const char *device, char *errbuf)
 {
-       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(errbuf, PCAP_ERRBUF_SIZE,
            "This version of libpcap only supports SNF cards");
        return NULL;
 }
index fed7c532f5c71d7819a6c6ed78c4667de4c1816a..fe46314d18e17f4704112b0593329a7521f88c4b 100644 (file)
@@ -310,7 +310,7 @@ pcap_activate_snoop(pcap_t *p)
                p->linktype = DLT_NULL;
                ll_hdrlen = 4;
        } else {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "snoop: unknown physical layer type");
                goto bad;
        }
index 759f7a297bbb30639110f13b697782622fc94538..167443354d4732845d7ed0840950936f2286d85d 100644 (file)
--- a/pcap-tc.c
+++ b/pcap-tc.c
@@ -551,7 +551,7 @@ TcActivate(pcap_t *p)
 
        if (pt->PpiPacket == NULL)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error allocating memory");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error allocating memory");
                return PCAP_ERROR;
        }
 
@@ -586,7 +586,7 @@ TcActivate(pcap_t *p)
        if (status != TC_SUCCESS)
        {
                /* Adapter detected but we are not able to open it. Return failure. */
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error opening TurboCap adapter: %s", g_TcFunctions.StatusGetString(status));
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Error opening TurboCap adapter: %s", g_TcFunctions.StatusGetString(status));
                return PCAP_ERROR;
        }
 
@@ -618,7 +618,7 @@ TcActivate(pcap_t *p)
 
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,"Error enabling reception on a TurboCap instance: %s", g_TcFunctions.StatusGetString(status));
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,"Error enabling reception on a TurboCap instance: %s", g_TcFunctions.StatusGetString(status));
                goto bad;
        }
 
@@ -657,7 +657,7 @@ TcActivate(pcap_t *p)
 
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,"Error setting the read timeout a TurboCap instance: %s", g_TcFunctions.StatusGetString(status));
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,"Error setting the read timeout a TurboCap instance: %s", g_TcFunctions.StatusGetString(status));
                goto bad;
        }
 
@@ -790,14 +790,14 @@ static int TcSetDatalink(pcap_t *p, int dlt)
 
 static int TcGetNonBlock(pcap_t *p)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Non-blocking mode isn't supported for TurboCap ports");
        return -1;
 }
 
 static int TcSetNonBlock(pcap_t *p, int nonblock)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Non-blocking mode isn't supported for TurboCap ports");
        return -1;
 }
@@ -839,7 +839,7 @@ static int TcInject(pcap_t *p, const void *buf, int size)
 
        if (size >= 0xFFFF)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: the TurboCap API does not support packets larger than 64k");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: the TurboCap API does not support packets larger than 64k");
                return -1;
        }
 
@@ -847,7 +847,7 @@ static int TcInject(pcap_t *p, const void *buf, int size)
 
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcPacketsBufferCreate failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcPacketsBufferCreate failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                return -1;
        }
 
@@ -867,12 +867,12 @@ static int TcInject(pcap_t *p, const void *buf, int size)
 
                if (status != TC_SUCCESS)
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcInstanceTransmitPackets failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcInstanceTransmitPackets failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                }
        }
        else
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcPacketsBufferCommitNextPacket failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "send error: TcPacketsBufferCommitNextPacket failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
        }
 
        g_TcFunctions.PacketsBufferDestroy(buffer);
@@ -912,7 +912,7 @@ static int TcRead(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                status = g_TcFunctions.InstanceReceivePackets(pt->TcInstance, &pt->TcPacketsBuffer);
                if (status != TC_SUCCESS)
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error, TcInstanceReceivePackets failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error, TcInstanceReceivePackets failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                        return -1;
                }
        }
@@ -962,7 +962,7 @@ static int TcRead(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
 
                if (status != TC_SUCCESS)
                {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error, TcPacketsBufferQueryNextPacket failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "read error, TcPacketsBufferQueryNextPacket failure: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                        return -1;
                }
 
@@ -1052,7 +1052,7 @@ TcStats(pcap_t *p, struct pcap_stat *ps)
 
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcInstanceQueryStatistics: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcInstanceQueryStatistics: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                return -1;
        }
 
@@ -1061,7 +1061,7 @@ TcStats(pcap_t *p, struct pcap_stat *ps)
        status = g_TcFunctions.StatisticsQueryValue(statistics, TC_COUNTER_INSTANCE_TOTAL_RX_PACKETS, &counter);
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                return -1;
        }
        if (counter <= (ULONGLONG)0xFFFFFFFF)
@@ -1076,7 +1076,7 @@ TcStats(pcap_t *p, struct pcap_stat *ps)
        status = g_TcFunctions.StatisticsQueryValue(statistics, TC_COUNTER_INSTANCE_RX_DROPPED_PACKETS, &counter);
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                return -1;
        }
        if (counter <= (ULONGLONG)0xFFFFFFFF)
@@ -1114,7 +1114,7 @@ TcStatsEx(pcap_t *p, int *pcap_stat_size)
 
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcInstanceQueryStatistics: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcInstanceQueryStatistics: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                return NULL;
        }
 
@@ -1123,7 +1123,7 @@ TcStatsEx(pcap_t *p, int *pcap_stat_size)
        status = g_TcFunctions.StatisticsQueryValue(statistics, TC_COUNTER_INSTANCE_TOTAL_RX_PACKETS, &counter);
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                return NULL;
        }
        if (counter <= (ULONGLONG)0xFFFFFFFF)
@@ -1138,7 +1138,7 @@ TcStatsEx(pcap_t *p, int *pcap_stat_size)
        status = g_TcFunctions.StatisticsQueryValue(statistics, TC_COUNTER_INSTANCE_RX_DROPPED_PACKETS, &counter);
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error in TcStatisticsQueryValue: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
                return NULL;
        }
        if (counter <= (ULONGLONG)0xFFFFFFFF)
@@ -1176,7 +1176,7 @@ TcSetMode(pcap_t *p, int mode)
 {
        if (mode != MODE_CAPT)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mode %u not supported by TurboCap devices. TurboCap only supports capture.", mode);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mode %u not supported by TurboCap devices. TurboCap only supports capture.", mode);
                return -1;
        }
 
@@ -1191,7 +1191,7 @@ TcSetMinToCopy(pcap_t *p, int size)
 
        if (size < 0)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mintocopy cannot be less than 0.");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "Mintocopy cannot be less than 0.");
                return -1;
        }
 
@@ -1199,7 +1199,7 @@ TcSetMinToCopy(pcap_t *p, int size)
 
        if (status != TC_SUCCESS)
        {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error setting the mintocopy: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "TurboCap error setting the mintocopy: %s (%08x)", g_TcFunctions.StatusGetString(status), status);
        }
 
        return 0;
@@ -1216,7 +1216,7 @@ TcGetReceiveWaitHandle(pcap_t *p)
 static int
 TcOidGetRequest(pcap_t *p, bpf_u_int32 oid _U_, void *data _U_, size_t *lenp _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "An OID get request cannot be performed on a TurboCap device");
        return PCAP_ERROR;
 }
@@ -1225,7 +1225,7 @@ static int
 TcOidSetRequest(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_,
     size_t *lenp _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "An OID set request cannot be performed on a TurboCap device");
        return PCAP_ERROR;
 }
@@ -1233,7 +1233,7 @@ TcOidSetRequest(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_,
 static u_int
 TcSendqueueTransmit(pcap_t *p, pcap_send_queue *queue _U_, int sync _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Packets cannot be bulk transmitted on a TurboCap device");
        return 0;
 }
@@ -1241,7 +1241,7 @@ TcSendqueueTransmit(pcap_t *p, pcap_send_queue *queue _U_, int sync _U_)
 static int
 TcSetUserBuffer(pcap_t *p, int size _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "The user buffer cannot be set on a TurboCap device");
        return -1;
 }
@@ -1249,7 +1249,7 @@ TcSetUserBuffer(pcap_t *p, int size _U_)
 static int
 TcLiveDump(pcap_t *p, char *filename _U_, int maxsize _U_, int maxpacks _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Live packet dumping cannot be performed on a TurboCap device");
        return -1;
 }
@@ -1257,7 +1257,7 @@ TcLiveDump(pcap_t *p, char *filename _U_, int maxsize _U_, int maxpacks _U_)
 static int
 TcLiveDumpEnded(pcap_t *p, int sync _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Live packet dumping cannot be performed on a TurboCap device");
        return -1;
 }
index fbf6206a956e6e0dbeb80d0a540048da9192874e..e6cb9d913385e4a0f40ff2f161466fa029de1229 100644 (file)
@@ -230,7 +230,7 @@ usb_dev_add(pcap_if_list_t *devlistp, int n, char *err_str)
 {
        char dev_name[10];
        char dev_descr[30];
-       pcap_snprintf(dev_name, 10, USB_IFACE"%d", n);
+       snprintf(dev_name, 10, USB_IFACE"%d", n);
        /*
         * XXX - is there any notion of "up" and "running"?
         */
@@ -251,7 +251,7 @@ usb_dev_add(pcap_if_list_t *devlistp, int n, char *err_str)
                 * PCAP_IF_CONNECTION_STATUS_CONNECTED or
                 * PCAP_IF_CONNECTION_STATUS_DISCONNECTED?
                 */
-               pcap_snprintf(dev_descr, 30, "Raw USB traffic, bus number %d", n);
+               snprintf(dev_descr, 30, "Raw USB traffic, bus number %d", n);
                if (add_dev(devlistp, dev_name, 0, dev_descr, err_str) == NULL)
                        return -1;
        }
@@ -505,7 +505,7 @@ probe_devices(int bus)
        DIR* dir;
 
        /* scan usb bus directories for device nodes */
-       pcap_snprintf(buf, sizeof(buf), "/dev/bus/usb/%03d", bus);
+       snprintf(buf, sizeof(buf), "/dev/bus/usb/%03d", bus);
        dir = opendir(buf);
        if (!dir)
                return;
@@ -517,7 +517,7 @@ probe_devices(int bus)
                if (name[0] == '.')
                        continue;
 
-               pcap_snprintf(buf, sizeof(buf), "/dev/bus/usb/%03d/%s", bus, data->d_name);
+               snprintf(buf, sizeof(buf), "/dev/bus/usb/%03d/%s", bus, data->d_name);
 
                fd = open(buf, O_RDWR);
                if (fd == -1)
@@ -627,7 +627,7 @@ usb_activate(pcap_t* handle)
        /*get usb bus index from device name */
        if (sscanf(handle->opt.device, USB_IFACE"%d", &handlep->bus_index) != 1)
        {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                        "Can't get USB bus index from %s", handle->opt.device);
                return PCAP_ERROR;
        }
@@ -638,7 +638,7 @@ usb_activate(pcap_t* handle)
                 * We have binary-mode support.
                 * Try to open the binary interface.
                 */
-               pcap_snprintf(full_path, USB_LINE_LEN, LINUX_USB_MON_DEV"%d", handlep->bus_index);
+               snprintf(full_path, USB_LINE_LEN, LINUX_USB_MON_DEV"%d", handlep->bus_index);
                handle->fd = open(full_path, O_RDONLY, 0);
                if (handle->fd < 0)
                {
@@ -731,7 +731,7 @@ usb_activate(pcap_t* handle)
                 * We don't have binary mode support.
                 * Try opening the text-mode device.
                 */
-               pcap_snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR"/%dt", handlep->bus_index);
+               snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR"/%dt", handlep->bus_index);
                handle->fd = open(full_path, O_RDONLY, 0);
                if (handle->fd < 0)
                {
@@ -741,7 +741,7 @@ usb_activate(pcap_t* handle)
                                 * Not found at the new location; try
                                 * the old location.
                                 */
-                               pcap_snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%dt", handlep->bus_index);
+                               snprintf(full_path, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%dt", handlep->bus_index);
                                handle->fd = open(full_path, O_RDONLY, 0);
                        }
                        if (handle->fd < 0) {
@@ -868,7 +868,7 @@ usb_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_cha
                &cnt);
        if (ret < 8)
        {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                    "Can't parse USB bus message '%s', too few tokens (expected 8 got %d)",
                    string, ret);
                return -1;
@@ -933,7 +933,7 @@ usb_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_cha
                str5, &cnt);
                if (ret < 5)
                {
-                       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                                "Can't parse USB bus message '%s', too few tokens (expected 5 got %d)",
                                string, ret);
                        return -1;
@@ -957,7 +957,7 @@ usb_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_cha
        ret = sscanf(string, " %d%n", &urb_len, &cnt);
        if (ret < 1)
        {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                  "Can't parse urb length from '%s'", string);
                return -1;
        }
@@ -975,7 +975,7 @@ usb_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_cha
        /* check for data presence; data is present if and only if urb tag is '=' */
        if (sscanf(string, " %c", &urb_tag) != 1)
        {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                        "Can't parse urb tag from '%s'", string);
                return -1;
        }
@@ -1023,7 +1023,7 @@ got:
 static int
 usb_inject_linux(pcap_t *handle, const void *buf _U_, int size _U_)
 {
-       pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
            "Packet injection is not supported on USB devices");
        return (-1);
 }
@@ -1039,7 +1039,7 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats)
        char * ptr = string;
        int fd;
 
-       pcap_snprintf(string, USB_LINE_LEN, USB_TEXT_DIR"/%ds", handlep->bus_index);
+       snprintf(string, USB_LINE_LEN, USB_TEXT_DIR"/%ds", handlep->bus_index);
        fd = open(string, O_RDONLY, 0);
        if (fd < 0)
        {
@@ -1049,7 +1049,7 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats)
                         * Not found at the new location; try the old
                         * location.
                         */
-                       pcap_snprintf(string, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%ds", handlep->bus_index);
+                       snprintf(string, USB_LINE_LEN, USB_TEXT_DIR_OLD"/%ds", handlep->bus_index);
                        fd = open(string, O_RDONLY, 0);
                }
                if (fd < 0) {
@@ -1068,7 +1068,7 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats)
 
        if (ret < 0)
        {
-               pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
                        "Can't read stats from fd %d ", fd);
                return -1;
        }
diff --git a/pcap.c b/pcap.c
index a232e3c596dd02d7b634b6a233a585ed285bee19..18a056c0492ce2e6311ce8d90dcc18bbff75c879 100644 (file)
--- a/pcap.c
+++ b/pcap.c
@@ -191,12 +191,12 @@ pcap_set_not_initialized_message(pcap_t *pcap)
 {
        if (pcap->activated) {
                /* A module probably forgot to set the function pointer */
-               (void)pcap_snprintf(pcap->errbuf, sizeof(pcap->errbuf),
+               (void)snprintf(pcap->errbuf, sizeof(pcap->errbuf),
                    "This operation isn't properly handled by that device");
                return;
        }
        /* in case the caller doesn't check for PCAP_ERROR_NOT_ACTIVATED */
-       (void)pcap_snprintf(pcap->errbuf, sizeof(pcap->errbuf),
+       (void)snprintf(pcap->errbuf, sizeof(pcap->errbuf),
            "This handle hasn't been activated yet");
 }
 
@@ -1457,7 +1457,7 @@ pcap_lookupnet(const char *device, bpf_u_int32 *netp, bpf_u_int32 *maskp,
        (void)pcap_strlcpy(ifr.ifr_name, device, sizeof(ifr.ifr_name));
        if (ioctl(fd, SIOCGIFADDR, (char *)&ifr) < 0) {
                if (errno == EADDRNOTAVAIL) {
-                       (void)pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "%s: no IPv4 address assigned", device);
                } else {
                        pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
@@ -1490,7 +1490,7 @@ pcap_lookupnet(const char *device, bpf_u_int32 *netp, bpf_u_int32 *maskp,
                else if (IN_CLASSC(*netp))
                        *maskp = IN_CLASSC_NET;
                else {
-                       (void)pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       (void)snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "inet class for 0x%x unknown", *netp);
                        return (-1);
                }
@@ -1786,7 +1786,7 @@ pcap_parse_source(const char *source, char **schemep, char **userinfop,
                                /*
                                 * There's no closing square bracket.
                                 */
-                               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                                    "IP-literal in URL doesn't end with ]");
                                free(userinfo);
                                free(authority);
@@ -1799,7 +1799,7 @@ pcap_parse_source(const char *source, char **schemep, char **userinfop,
                                 * There's extra crud after the
                                 * closing square bracketn.
                                 */
-                               pcap_snprintf(ebuf, PCAP_ERRBUF_SIZE,
+                               snprintf(ebuf, PCAP_ERRBUF_SIZE,
                                    "Extra text after IP-literal in URL");
                                free(userinfo);
                                free(authority);
@@ -1905,7 +1905,7 @@ pcap_createsrcstr_ex(char *source, int type, const char *host, const char *port,
                        pcap_strlcat(source, name, PCAP_BUF_SIZE);
                        return (0);
                } else {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "The file name cannot be NULL.");
                        return (-1);
                }
@@ -1934,7 +1934,7 @@ pcap_createsrcstr_ex(char *source, int type, const char *host, const char *port,
 
                        pcap_strlcat(source, "/", PCAP_BUF_SIZE);
                } else {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "The host name cannot be NULL.");
                        return (-1);
                }
@@ -1953,7 +1953,7 @@ pcap_createsrcstr_ex(char *source, int type, const char *host, const char *port,
                return (0);
 
        default:
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "The interface type is not valid.");
                return (-1);
        }
@@ -2024,7 +2024,7 @@ pcap_parsesrcstr_ex(const char *source, int *type, char *host, char *port,
                 */
                if (host && tmphost) {
                        if (tmpuserinfo)
-                               pcap_snprintf(host, PCAP_BUF_SIZE, "%s@%s",
+                               snprintf(host, PCAP_BUF_SIZE, "%s@%s",
                                    tmpuserinfo, tmphost);
                        else
                                pcap_strlcpy(host, tmphost, PCAP_BUF_SIZE);
@@ -2138,7 +2138,7 @@ pcap_create(const char *device, char *errbuf)
                                return (NULL);
                        }
 
-                       pcap_snprintf(device_str, length + 1, "%ws",
+                       snprintf(device_str, length + 1, "%ws",
                            (const wchar_t *)device);
                } else
 #endif
@@ -2374,7 +2374,7 @@ int
 pcap_check_activated(pcap_t *p)
 {
        if (p->activated) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "can't perform "
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "can't perform "
                        " operation on activated capture");
                return (-1);
        }
@@ -2582,7 +2582,7 @@ pcap_activate(pcap_t *p)
                         * handle errors other than PCAP_ERROR, return the
                         * error message corresponding to the status.
                         */
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s",
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "%s",
                            pcap_statustostr(status));
                }
 
@@ -2640,7 +2640,7 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, char *er
                    NULL, errbuf));
        }
        if (srctype == PCAP_SRC_FILE) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "unknown URL scheme \"file\"");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "unknown URL scheme \"file\"");
                return (NULL);
        }
        if (srctype == PCAP_SRC_IFLOCAL) {
@@ -2687,15 +2687,15 @@ pcap_open_live(const char *device, int snaplen, int promisc, int to_ms, char *er
        return (p);
 fail:
        if (status == PCAP_ERROR)
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %.*s", device,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %.*s", device,
                    PCAP_ERRBUF_SIZE - 3, p->errbuf);
        else if (status == PCAP_ERROR_NO_SUCH_DEVICE ||
            status == PCAP_ERROR_PERM_DENIED ||
            status == PCAP_ERROR_PROMISC_PERM_DENIED)
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%.*s)", device,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s (%.*s)", device,
                    pcap_statustostr(status), PCAP_ERRBUF_SIZE - 6, p->errbuf);
        else
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", device,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "%s: %s", device,
                    pcap_statustostr(status));
        pcap_close(p);
        return (NULL);
@@ -2880,11 +2880,11 @@ pcap_set_datalink(pcap_t *p, int dlt)
 unsupported:
        dlt_name = pcap_datalink_val_to_name(dlt);
        if (dlt_name != NULL) {
-               (void) pcap_snprintf(p->errbuf, sizeof(p->errbuf),
+               (void) snprintf(p->errbuf, sizeof(p->errbuf),
                    "%s is not one of the DLTs supported by this device",
                    dlt_name);
        } else {
-               (void) pcap_snprintf(p->errbuf, sizeof(p->errbuf),
+               (void) snprintf(p->errbuf, sizeof(p->errbuf),
                    "DLT %d is not one of the DLTs supported by this device",
                    dlt);
        }
@@ -3186,7 +3186,7 @@ pcap_datalink_val_to_description_or_dlt(int dlt)
         if (description != NULL) {
                 return description;
         } else {
-                (void)pcap_snprintf(unkbuf, sizeof(unkbuf), "DLT %u", dlt);
+                (void)snprintf(unkbuf, sizeof(unkbuf), "DLT %u", dlt);
                 return unkbuf;
         }
 }
@@ -3478,7 +3478,7 @@ pcap_statustostr(int errnum)
        case PCAP_ERROR_TSTAMP_PRECISION_NOTSUP:
                return ("That device doesn't support that time stamp precision");
        }
-       (void)pcap_snprintf(ebuf, sizeof ebuf, "Unknown error: %d", errnum);
+       (void)snprintf(ebuf, sizeof ebuf, "Unknown error: %d", errnum);
        return(ebuf);
 }
 
@@ -3506,7 +3506,7 @@ pcap_strerror(int errnum)
 
        if ((unsigned int)errnum < sys_nerr)
                return ((char *)sys_errlist[errnum]);
-       (void)pcap_snprintf(errbuf, sizeof errbuf, "Unknown error: %d", errnum);
+       (void)snprintf(errbuf, sizeof errbuf, "Unknown error: %d", errnum);
        return (errbuf);
 #endif
 }
@@ -3527,7 +3527,7 @@ int
 pcap_setdirection(pcap_t *p, pcap_direction_t d)
 {
        if (p->setdirection_op == NULL) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "Setting direction is not implemented on this platform");
                return (-1);
        } else
@@ -3663,7 +3663,7 @@ pcap_get_airpcap_handle(pcap_t *p)
 
        handle = p->get_airpcap_handle_op(p);
        if (handle == NULL) {
-               (void)pcap_snprintf(p->errbuf, sizeof(p->errbuf),
+               (void)snprintf(p->errbuf, sizeof(p->errbuf),
                    "This isn't an AirPcap device");
        }
        return (handle);
@@ -3873,7 +3873,7 @@ pcap_offline_filter(const struct bpf_program *fp, const struct pcap_pkthdr *h,
 static int
 pcap_can_set_rfmon_dead(pcap_t *p)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Rfmon mode doesn't apply on a pcap_open_dead pcap_t");
        return (PCAP_ERROR);
 }
@@ -3882,7 +3882,7 @@ static int
 pcap_read_dead(pcap_t *p, int cnt _U_, pcap_handler callback _U_,
     u_char *user _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Packets aren't available from a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -3890,7 +3890,7 @@ pcap_read_dead(pcap_t *p, int cnt _U_, pcap_handler callback _U_,
 static int
 pcap_inject_dead(pcap_t *p, const void *buf _U_, int size _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Packets can't be sent on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -3898,7 +3898,7 @@ pcap_inject_dead(pcap_t *p, const void *buf _U_, int size _U_)
 static int
 pcap_setfilter_dead(pcap_t *p, struct bpf_program *fp _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "A filter cannot be set on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -3906,7 +3906,7 @@ pcap_setfilter_dead(pcap_t *p, struct bpf_program *fp _U_)
 static int
 pcap_setdirection_dead(pcap_t *p, pcap_direction_t d _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "The packet direction cannot be set on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -3914,7 +3914,7 @@ pcap_setdirection_dead(pcap_t *p, pcap_direction_t d _U_)
 static int
 pcap_set_datalink_dead(pcap_t *p, int dlt _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "The link-layer header type cannot be set on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -3922,7 +3922,7 @@ pcap_set_datalink_dead(pcap_t *p, int dlt _U_)
 static int
 pcap_getnonblock_dead(pcap_t *p)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "A pcap_open_dead pcap_t does not have a non-blocking mode setting");
        return (-1);
 }
@@ -3930,7 +3930,7 @@ pcap_getnonblock_dead(pcap_t *p)
 static int
 pcap_setnonblock_dead(pcap_t *p, int nonblock _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "A pcap_open_dead pcap_t does not have a non-blocking mode setting");
        return (-1);
 }
@@ -3938,7 +3938,7 @@ pcap_setnonblock_dead(pcap_t *p, int nonblock _U_)
 static int
 pcap_stats_dead(pcap_t *p, struct pcap_stat *ps _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Statistics aren't available from a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -3947,7 +3947,7 @@ pcap_stats_dead(pcap_t *p, struct pcap_stat *ps _U_)
 struct pcap_stat *
 pcap_stats_ex_dead(pcap_t *p, int *pcap_stat_size _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Statistics aren't available from a pcap_open_dead pcap_t");
        return (NULL);
 }
@@ -3955,7 +3955,7 @@ pcap_stats_ex_dead(pcap_t *p, int *pcap_stat_size _U_)
 static int
 pcap_setbuff_dead(pcap_t *p, int dim)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "The kernel buffer size cannot be set on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -3963,7 +3963,7 @@ pcap_setbuff_dead(pcap_t *p, int dim)
 static int
 pcap_setmode_dead(pcap_t *p, int mode)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "impossible to set mode on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -3971,7 +3971,7 @@ pcap_setmode_dead(pcap_t *p, int mode)
 static int
 pcap_setmintocopy_dead(pcap_t *p, int size)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "The mintocopy parameter cannot be set on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -3979,7 +3979,7 @@ pcap_setmintocopy_dead(pcap_t *p, int size)
 static HANDLE
 pcap_getevent_dead(pcap_t *p)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "A pcap_open_dead pcap_t has no event handle");
        return (INVALID_HANDLE_VALUE);
 }
@@ -3988,7 +3988,7 @@ static int
 pcap_oid_get_request_dead(pcap_t *p, bpf_u_int32 oid _U_, void *data _U_,
     size_t *lenp _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "An OID get request cannot be performed on a pcap_open_dead pcap_t");
        return (PCAP_ERROR);
 }
@@ -3997,7 +3997,7 @@ static int
 pcap_oid_set_request_dead(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_,
     size_t *lenp _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "An OID set request cannot be performed on a pcap_open_dead pcap_t");
        return (PCAP_ERROR);
 }
@@ -4005,7 +4005,7 @@ pcap_oid_set_request_dead(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_,
 static u_int
 pcap_sendqueue_transmit_dead(pcap_t *p, pcap_send_queue *queue, int sync)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Packets cannot be transmitted on a pcap_open_dead pcap_t");
        return (0);
 }
@@ -4013,7 +4013,7 @@ pcap_sendqueue_transmit_dead(pcap_t *p, pcap_send_queue *queue, int sync)
 static int
 pcap_setuserbuffer_dead(pcap_t *p, int size)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "The user buffer cannot be set on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -4021,7 +4021,7 @@ pcap_setuserbuffer_dead(pcap_t *p, int size)
 static int
 pcap_live_dump_dead(pcap_t *p, char *filename, int maxsize, int maxpacks)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Live packet dumping cannot be performed on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -4029,7 +4029,7 @@ pcap_live_dump_dead(pcap_t *p, char *filename, int maxsize, int maxpacks)
 static int
 pcap_live_dump_ended_dead(pcap_t *p, int sync)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Live packet dumping cannot be performed on a pcap_open_dead pcap_t");
        return (-1);
 }
index e64da93aa4ce29761b16fa63e85e942381f52d63..687cbbd4e39a65a178fbadd9e98fc51c29e2b67a 100644 (file)
    * __attribute__((deprecated(msg))).
    */
   #define PCAP_DEPRECATED(func, msg)   __attribute__((deprecated))
-#elif (defined(_MSC_VER) && (_MSC_VER >= 1500)) && !defined(BUILDING_PCAP)
+#elif (defined(_MSC_VER) && !defined(BUILDING_PCAP)
   /*
-   * MSVC from Visual Studio 2008 or later, and we're not building
-   * libpcap itself.
+   * MSVC, and we're not building libpcap itself; it's VS 2015
+   * or later, so we have the deprecated pragma.
    *
    * If we *are* building libpcap, we don't want this, as it'll warn
    * us even if we *define* the function.
  */
 #ifdef _MSC_VER
  #include <sal.h>
- #if _MSC_VER > 1400
-  #define PCAP_FORMAT_STRING(p) _Printf_format_string_ p
- #else
-  #define PCAP_FORMAT_STRING(p) __format_string p
- #endif
+ #define PCAP_FORMAT_STRING(p) _Printf_format_string_ p
 #else
  #define PCAP_FORMAT_STRING(p) p
 #endif
index af2c23c877edfd201d7e9ae96b382fd2563478d7..afd520b75c0d41610231cb7ee20cfffa62daca06 100644 (file)
 
 /*
  * Get the integer types and PRi[doux]64 values from C99 <inttypes.h>
- * defined, by hook or by crook.
+ * defined.
+ *
+ * If the compiler is MSVC, we require VS 2015 or newer, so we
+ * have <inttypes.h> - and support for %zu in the formatted
+ * printing functions.
+ *
+ * If the compiler is MinGW, we assume we have <inttypes.h> - and
+ * support for %zu in the formatted printing functions.
+ *
+ * If the target is UN*X, we assume we have a C99-or-later development
+ * environment, and thus have <inttypes.h> - and support for %zu in
+ * the formatted printing functions.
+ *
+ * If the target is MS-DOS, we assume we have <inttypes.h> - and support
+ * for %zu in the formatted printing functions.
  */
 #if defined(_MSC_VER)
   /*
-   * Compiler is MSVC.
+   * Compiler is MSVC.  Make sure we have VS 2015 or later.
    */
-  #if _MSC_VER >= 1800
-    /*
-     * VS 2013 or newer; we have <inttypes.h>.
-     */
-    #include <inttypes.h>
-  #else
-    /*
-     * Earlier VS; we have to define this stuff ourselves.
-     */
-    typedef unsigned char uint8_t;
-    typedef signed char int8_t;
-    typedef unsigned short uint16_t;
-    typedef signed short int16_t;
-    typedef unsigned int uint32_t;
-    typedef signed int int32_t;
-    #ifdef _MSC_EXTENSIONS
-      typedef unsigned _int64 uint64_t;
-      typedef _int64 int64_t;
-    #else /* _MSC_EXTENSIONS */
-      typedef unsigned long long uint64_t;
-      typedef long long int64_t;
-    #endif
+  #if _MSC_VER < 1900
+    #error "Building libpcap requires VS 2015 or later"
   #endif
 
   /*
    * These may be defined by <inttypes.h>.
    *
+   * XXX - given the assumptions above, will they ever *not* be
+   * defined by <inttypes.h>?
+   *
    * XXX - for MSVC, we always want the _MSC_EXTENSIONS versions.
    * What about other compilers?  If, as the MinGW Web site says MinGW
    * does, the other compilers just use Microsoft's run-time library,
    * then they should probably use the _MSC_EXTENSIONS even if the
    * compiler doesn't define _MSC_EXTENSIONS.
-   *
-   * XXX - we currently aren't using any of these, but this allows
-   * their use in the future.
    */
   #ifndef PRId64
     #ifdef _MSC_EXTENSIONS
       #define PRIu64   "llu"
     #endif
   #endif
-#elif defined(__MINGW32__) || !defined(_WIN32)
-  /*
-   * Compiler is MinGW or target is UN*X or MS-DOS.  Just use
-   * <inttypes.h>.
-   */
-  #include <inttypes.h>
 #endif
 
 #endif /* pcap/pcap-inttypes.h */
index 543846e8bd25eb22d904554544a668faccd70852..39e1583b4f83d170e4dddf794c077016ddcc18fc 100644 (file)
@@ -52,7 +52,7 @@ extern "C" {
   #if defined(_MSC_VER) || defined(__MINGW32__)
     /*
      * strncat_s() is supported at least back to Visual
-     * Studio 2005.
+     * Studio 2005; we require Visual Studio 2015 or later.
      */
     #define pcap_strlcat(x, y, z) \
        strncat_s((x), (z), (y), _TRUNCATE)
@@ -70,7 +70,7 @@ extern "C" {
   #if defined(_MSC_VER) || defined(__MINGW32__)
     /*
      * strncpy_s() is supported at least back to Visual
-     * Studio 2005.
+     * Studio 2005; we require Visual Studio 2015 or later.
      */
     #define pcap_strlcpy(x, y, z) \
        strncpy_s((x), (z), (y), _TRUNCATE)
@@ -97,43 +97,9 @@ extern "C" {
 #endif
 
 /*
- * On Windows, snprintf(), with that name and with C99 behavior - i.e.,
- * guaranteeing that the formatted string is null-terminated - didn't
- * appear until Visual Studio 2015.  Prior to that, the C runtime had
- * only _snprintf(), which *doesn't* guarantee that the string is
- * null-terminated if it is truncated due to the buffer being too
- * small.  We therefore can't just define snprintf to be _snprintf
- * and define vsnprintf to be _vsnprintf, as we're relying on null-
- * termination of strings in all cases.
- *
- * We also want to allow this to be built with versions of Visual Studio
- * prior to VS 2015, so we can't rely on snprintf() being present.
- *
- * And we want to make sure that, if we support plugins in the future,
- * a routine with C99 snprintf() behavior will be available to them.
- * We also don't want it to collide with the C library snprintf() if
- * there is one.
- *
- * So we make pcap_snprintf() and pcap_vsnprintf() available, either by
- * #defining them to be snprintf or vsnprintf, respectively, or by
- * defining our own versions and exporting them.
- */
-#ifdef HAVE_SNPRINTF
-#define pcap_snprintf snprintf
-#else
-extern int pcap_snprintf(char *, size_t, PCAP_FORMAT_STRING(const char *), ...)
-    PCAP_PRINTFLIKE(3, 4);
-#endif
-
-#ifdef HAVE_VSNPRINTF
-#define pcap_vsnprintf vsnprintf
-#else
-extern int pcap_vsnprintf(char *, size_t, const char *, va_list ap);
-#endif
-
-/*
- * We also want asprintf(), for some cases where we use it to construct
- * dynamically-allocated variable-length strings.
+ * We want asprintf(), for some cases where we use it to construct
+ * dynamically-allocated variable-length strings; it's present on
+ * some, but not all, platforms.
  */
 #ifdef HAVE_ASPRINTF
 #define pcap_asprintf asprintf
index aaa54c9e3b885dd375fb6527337865949e707f17..42cb21817df74fbf387d723c912780f0dcd8b5ea 100644 (file)
@@ -626,11 +626,11 @@ daemon_serviceloop(SOCKET sockctrl, int isactive, char *passiveClients,
                                msg_type_string = rpcap_msg_type_string(header.type);
                                if (msg_type_string != NULL)
                                {
-                                       pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "%s request sent before authentication was completed", msg_type_string);
+                                       snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "%s request sent before authentication was completed", msg_type_string);
                                }
                                else
                                {
-                                       pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Message of type %u sent before authentication was completed", header.type);
+                                       snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Message of type %u sent before authentication was completed", header.type);
                                }
                                if (rpcap_senderror(pars.sockctrl, pars.ssl,
                                    header.ver, PCAP_ERR_WRONGMSG,
@@ -662,11 +662,11 @@ daemon_serviceloop(SOCKET sockctrl, int isactive, char *passiveClients,
                                msg_type_string = rpcap_msg_type_string(header.type);
                                if (msg_type_string != NULL)
                                {
-                                       pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Server-to-client message %s received from client", msg_type_string);
+                                       snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Server-to-client message %s received from client", msg_type_string);
                                }
                                else
                                {
-                                       pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Server-to-client message of type %u received from client", header.type);
+                                       snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Server-to-client message of type %u received from client", header.type);
                                }
                                if (rpcap_senderror(pars.sockctrl, pars.ssl,
                                    header.ver, PCAP_ERR_WRONGMSG,
@@ -687,7 +687,7 @@ daemon_serviceloop(SOCKET sockctrl, int isactive, char *passiveClients,
                                //
                                // Unknown message type.
                                //
-                               pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Unknown message type %u", header.type);
+                               snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Unknown message type %u", header.type);
                                if (rpcap_senderror(pars.sockctrl, pars.ssl,
                                    header.ver, PCAP_ERR_WRONGMSG,
                                    errmsgbuf, errbuf) == -1)
@@ -1036,12 +1036,12 @@ daemon_serviceloop(SOCKET sockctrl, int isactive, char *passiveClients,
                                if (msg_type_string != NULL)
                                {
                                        rpcapd_log(LOGPRIO_INFO, "The client sent a %s server-to-client message", msg_type_string);
-                                       pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Server-to-client message %s received from client", msg_type_string);
+                                       snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Server-to-client message %s received from client", msg_type_string);
                                }
                                else
                                {
                                        rpcapd_log(LOGPRIO_INFO, "The client sent a server-to-client message of type %u", header.type);
-                                       pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Server-to-client message of type %u received from client", header.type);
+                                       snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Server-to-client message of type %u received from client", header.type);
                                }
                                if (rpcap_senderror(pars.sockctrl, pars.ssl,
                                    header.ver, PCAP_ERR_WRONGMSG,
@@ -1063,7 +1063,7 @@ daemon_serviceloop(SOCKET sockctrl, int isactive, char *passiveClients,
                                // Unknown message type.
                                //
                                rpcapd_log(LOGPRIO_INFO, "The client sent a message of type %u", header.type);
-                               pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Unknown message type %u", header.type);
+                               snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Unknown message type %u", header.type);
                                if (rpcap_senderror(pars.sockctrl, pars.ssl,
                                    header.ver, PCAP_ERR_WRONGMSG,
                                    errbuf, errmsgbuf) == -1)
@@ -1222,7 +1222,7 @@ daemon_msg_auth_req(struct daemon_slpars *pars, uint32 plen)
                        if (!pars->nullAuthAllowed)
                        {
                                // Send the client an error reply.
-                               pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errmsgbuf, PCAP_ERRBUF_SIZE,
                                    "Authentication failed; NULL authentication not permitted.");
                                if (rpcap_senderror(pars->sockctrl, pars->ssl,
                                    0, PCAP_ERR_AUTH_FAILED, errmsgbuf, errbuf) == -1)
@@ -1322,7 +1322,7 @@ daemon_msg_auth_req(struct daemon_slpars *pars, uint32 plen)
                        }
 
                default:
-                       pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errmsgbuf, PCAP_ERRBUF_SIZE,
                            "Authentication type not recognized.");
                        if (rpcap_senderror(pars->sockctrl, pars->ssl,
                            0, PCAP_ERR_AUTH_TYPE_NOTSUP, errmsgbuf, errbuf) == -1)
@@ -1462,7 +1462,7 @@ daemon_AuthUserPwd(char *username, char *password, char *errbuf)
        // This call is needed to get the uid
        if ((user = getpwnam(username)) == NULL)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Authentication failed: user name or password incorrect");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Authentication failed: user name or password incorrect");
                return -1;
        }
 
@@ -1470,7 +1470,7 @@ daemon_AuthUserPwd(char *username, char *password, char *errbuf)
        // This call is needed to get the password; otherwise 'x' is returned
        if ((usersp = getspnam(username)) == NULL)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Authentication failed: user name or password incorrect");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Authentication failed: user name or password incorrect");
                return -1;
        }
        user_password = usersp->sp_pwdp;
@@ -1490,7 +1490,7 @@ daemon_AuthUserPwd(char *username, char *password, char *errbuf)
 
        if (strcmp(user_password, (char *) crypt(password, user_password)) != 0)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Authentication failed: user name or password incorrect");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Authentication failed: user name or password incorrect");
                return -1;
        }
 
@@ -1733,7 +1733,7 @@ daemon_msg_open_req(uint8 ver, struct daemon_slpars *pars, uint32 plen,
 
        if (plen > sourcelen - 1)
        {
-               pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Source string too long");
+               snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Source string too long");
                goto error;
        }
 
@@ -1861,7 +1861,7 @@ daemon_msg_startcap_req(uint8 ver, struct daemon_slpars *pars, uint32 plen,
        // to enforce encryption, as SSL is not supported yet with UDP:
        if (uses_ssl && (startcapreq.flags & RPCAP_STARTCAPREQ_FLAG_DGRAM))
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "SSL not supported with UDP forward of remote packets");
                goto error;
        }
@@ -1870,7 +1870,7 @@ daemon_msg_startcap_req(uint8 ver, struct daemon_slpars *pars, uint32 plen,
        session = malloc(sizeof(struct session));
        if (session == NULL)
        {
-               pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Can't allocate session structure");
+               snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Can't allocate session structure");
                goto error;
        }
 
@@ -1937,7 +1937,7 @@ daemon_msg_startcap_req(uint8 ver, struct daemon_slpars *pars, uint32 plen,
        // Now we have to create a new socket to send packets
        if (serveropen_dp)              // Data connection is opened by the server toward the client
        {
-               pcap_snprintf(portdata, sizeof portdata, "%d", ntohs(startcapreq.portdata));
+               snprintf(portdata, sizeof portdata, "%d", ntohs(startcapreq.portdata));
 
                // Get the name of the other peer (needed to connect to that specific network address)
                if (getnameinfo((struct sockaddr *) &saddr, saddrlen, peerhost,
@@ -2078,7 +2078,7 @@ daemon_msg_startcap_req(uint8 ver, struct daemon_slpars *pars, uint32 plen,
            (void *) session, 0, NULL);
        if (session->thread == 0)
        {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error creating the data thread");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error creating the data thread");
                goto error;
        }
 #else
@@ -2195,7 +2195,7 @@ daemon_unpackapplyfilter(SOCKET sockctrl, SSL *ctrl_ssl, struct session *session
 
        if (ntohs(filter.filtertype) != RPCAP_UPDATEFILTER_BPF)
        {
-               pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Only BPF/NPF filters are currently supported");
+               snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Only BPF/NPF filters are currently supported");
                return -2;
        }
 
@@ -2235,13 +2235,13 @@ daemon_unpackapplyfilter(SOCKET sockctrl, SSL *ctrl_ssl, struct session *session
        //
        if (bpf_validate(bf_prog.bf_insns, bf_prog.bf_len) == 0)
        {
-               pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "The filter contains bogus instructions");
+               snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "The filter contains bogus instructions");
                return -2;
        }
 
        if (pcap_setfilter(session->fp, &bf_prog))
        {
-               pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "RPCAP error: %s", pcap_geterr(session->fp));
+               snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "RPCAP error: %s", pcap_geterr(session->fp));
                return -2;
        }
 
@@ -2396,7 +2396,7 @@ daemon_msg_stats_req(uint8 ver, struct daemon_slpars *pars,
        {
                if (pcap_stats(session->fp, stats) == -1)
                {
-                       pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "%s", pcap_geterr(session->fp));
+                       snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "%s", pcap_geterr(session->fp));
                        goto error;
                }
 
@@ -2627,7 +2627,7 @@ daemon_thrdatamain(void *ptr)
                // The latter just means that the client told us to stop
                // capturing, so there's no error to report.
                //
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error reading the packets: %s", pcap_geterr(session->fp));
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error reading the packets: %s", pcap_geterr(session->fp));
                rpcap_senderror(session->sockctrl, session->ctrl_ssl, session->protocol_version,
                    PCAP_ERR_READEX, errbuf, NULL);
        }
@@ -2774,7 +2774,7 @@ rpcapd_recv(SOCKET sock, SSL *ssl, char *buffer, size_t toread, uint32 *plen, ch
        if (toread > *plen)
        {
                // Tell the client and continue.
-               pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Message payload is too short");
+               snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, "Message payload is too short");
                return -2;
        }
        nread = sock_recv(sock, ssl, buffer, toread,
index 7b5fee57caafe9dfbed36b0a5ca123b8f69261d1..f26c145e6ca1f1b31d109f597940e028c008737c 100644 (file)
@@ -229,7 +229,7 @@ static void rpcapd_vlog_systemlog(log_priority priority, const char *message,
         */
        char logbuf[1024+1];
 
-       pcap_vsnprintf(logbuf, sizeof logbuf, message, ap);
+       vsnprintf(logbuf, sizeof logbuf, message, ap);
        syslog(syslog_priority, "%s", logbuf);
 #endif
 }
index 25eb67d63f047f2dde57b592b83032befc45bfd5..5b6c14cd1404ebe320ebc1d2df70c086b9488f34 100644 (file)
@@ -1347,7 +1347,7 @@ main_active(void *ptr)
                {
                        rpcapd_log(LOGPRIO_DEBUG, "%s", errbuf);
 
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error connecting to host %s, port %s, using protocol %s",
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "Error connecting to host %s, port %s, using protocol %s",
                                        activepars->address, activepars->port, (hints.ai_family == AF_INET) ? "IPv4":
                                        (hints.ai_family == AF_INET6) ? "IPv6" : "Unspecified");
 
index 415e68449908b88f5ce047b2ad22bf65ac71bf92..00030681467301fc8868f55925e68a2fec2d4d45 100644 (file)
@@ -106,7 +106,7 @@ sf_setnonblock(pcap_t *p, int nonblock _U_)
         * as it would have to handle reading partial packets and
         * keeping the state of the read.)
         */
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Savefiles cannot be put into non-blocking mode");
        return (-1);
 }
@@ -114,7 +114,7 @@ sf_setnonblock(pcap_t *p, int nonblock _U_)
 static int
 sf_stats(pcap_t *p, struct pcap_stat *ps _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Statistics aren't available from savefiles");
        return (-1);
 }
@@ -123,7 +123,7 @@ sf_stats(pcap_t *p, struct pcap_stat *ps _U_)
 static struct pcap_stat *
 sf_stats_ex(pcap_t *p, int *size)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Statistics aren't available from savefiles");
        return (NULL);
 }
@@ -131,7 +131,7 @@ sf_stats_ex(pcap_t *p, int *size)
 static int
 sf_setbuff(pcap_t *p, int dim)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "The kernel buffer size cannot be set while reading from a file");
        return (-1);
 }
@@ -139,7 +139,7 @@ sf_setbuff(pcap_t *p, int dim)
 static int
 sf_setmode(pcap_t *p, int mode)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "impossible to set mode while reading from a file");
        return (-1);
 }
@@ -147,7 +147,7 @@ sf_setmode(pcap_t *p, int mode)
 static int
 sf_setmintocopy(pcap_t *p, int size)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "The mintocopy parameter cannot be set while reading from a file");
        return (-1);
 }
@@ -155,7 +155,7 @@ sf_setmintocopy(pcap_t *p, int size)
 static HANDLE
 sf_getevent(pcap_t *pcap)
 {
-       (void)pcap_snprintf(pcap->errbuf, sizeof(pcap->errbuf),
+       (void)snprintf(pcap->errbuf, sizeof(pcap->errbuf),
            "The read event cannot be retrieved while reading from a file");
        return (INVALID_HANDLE_VALUE);
 }
@@ -164,7 +164,7 @@ static int
 sf_oid_get_request(pcap_t *p, bpf_u_int32 oid _U_, void *data _U_,
     size_t *lenp _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "An OID get request cannot be performed on a file");
        return (PCAP_ERROR);
 }
@@ -173,7 +173,7 @@ static int
 sf_oid_set_request(pcap_t *p, bpf_u_int32 oid _U_, const void *data _U_,
     size_t *lenp _U_)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "An OID set request cannot be performed on a file");
        return (PCAP_ERROR);
 }
@@ -189,7 +189,7 @@ sf_sendqueue_transmit(pcap_t *p, pcap_send_queue *queue, int sync)
 static int
 sf_setuserbuffer(pcap_t *p, int size)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "The user buffer cannot be set when reading from a file");
        return (-1);
 }
@@ -197,7 +197,7 @@ sf_setuserbuffer(pcap_t *p, int size)
 static int
 sf_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Live packet dumping cannot be performed when reading from a file");
        return (-1);
 }
@@ -205,7 +205,7 @@ sf_live_dump(pcap_t *p, char *filename, int maxsize, int maxpacks)
 static int
 sf_live_dump_ended(pcap_t *p, int sync)
 {
-       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
            "Live packet dumping cannot be performed on a pcap_open_dead pcap_t");
        return (-1);
 }
@@ -232,7 +232,7 @@ sf_inject(pcap_t *p, const void *buf _U_, int size _U_)
 static int
 sf_setdirection(pcap_t *p, pcap_direction_t d _U_)
 {
-       pcap_snprintf(p->errbuf, sizeof(p->errbuf),
+       snprintf(p->errbuf, sizeof(p->errbuf),
            "Setting direction is not supported on savefiles");
        return (-1);
 }
@@ -255,7 +255,7 @@ pcap_open_offline_with_tstamp_precision(const char *fname, u_int precision,
        pcap_t *p;
 
        if (fname == NULL) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "A null pointer was supplied as the file name");
                return (NULL);
        }
@@ -394,7 +394,7 @@ pcap_fopen_offline_with_tstamp_precision(FILE *fp, u_int precision,
                        pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
                            errno, "error reading dump file");
                } else {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "truncated dump file; tried to read %zu file header bytes, only got %zu",
                            sizeof(magic), amt_read);
                }
@@ -421,7 +421,7 @@ pcap_fopen_offline_with_tstamp_precision(FILE *fp, u_int precision,
        /*
         * Well, who knows what this mess is....
         */
-       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "unknown file format");
+       snprintf(errbuf, PCAP_ERRBUF_SIZE, "unknown file format");
        return (NULL);
 
 found:
index cb980ce729b5f6f370f01e2915659a605204e678..8222aef7067ad59c3876083c91f4664e96677233 100644 (file)
--- a/sf-pcap.c
+++ b/sf-pcap.c
@@ -194,7 +194,7 @@ pcap_check_header(const uint8_t *magic, FILE *fp, u_int precision, char *errbuf,
                        pcap_fmt_errmsg_for_errno(errbuf, PCAP_ERRBUF_SIZE,
                            errno, "error reading dump file");
                } else {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "truncated dump file; tried to read %zu file header bytes, only got %zu",
                            sizeof(hdr), amt_read);
                }
@@ -215,7 +215,7 @@ pcap_check_header(const uint8_t *magic, FILE *fp, u_int precision, char *errbuf,
        }
 
        if (hdr.version_major < PCAP_VERSION_MAJOR) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "archaic pcap savefile format");
                *err = 1;
                return (NULL);
@@ -229,7 +229,7 @@ pcap_check_header(const uint8_t *magic, FILE *fp, u_int precision, char *errbuf,
                hdr.version_minor <= PCAP_VERSION_MINOR) ||
               (hdr.version_major == 543 &&
                hdr.version_minor == 0))) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                         "unsupported pcap savefile version %u.%u",
                         hdr.version_major, hdr.version_minor);
                *err = 1;
@@ -300,7 +300,7 @@ pcap_check_header(const uint8_t *magic, FILE *fp, u_int precision, char *errbuf,
                break;
 
        default:
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "unknown time stamp resolution %u", precision);
                free(p);
                *err = 1;
@@ -403,7 +403,7 @@ pcap_check_header(const uint8_t *magic, FILE *fp, u_int precision, char *errbuf,
                p->bufsize = 2048;
        p->buffer = malloc(p->bufsize);
        if (p->buffer == NULL) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "out of memory");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "out of memory");
                free(p);
                *err = 1;
                return (NULL);
@@ -424,7 +424,7 @@ grow_buffer(pcap_t *p, u_int bufsize)
 
        bigger_buffer = realloc(p->buffer, bufsize);
        if (bigger_buffer == NULL) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "out of memory");
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE, "out of memory");
                return (0);
        }
        p->buffer = bigger_buffer;
@@ -461,7 +461,7 @@ pcap_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                        return (-1);
                } else {
                        if (amt_read != 0) {
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "truncated dump file; tried to read %zu header bytes, only got %zu",
                                    ps->hdrsize, amt_read);
                                return (-1);
@@ -545,11 +545,11 @@ pcap_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                 * below.)
                 */
                if (hdr->caplen > (bpf_u_int32)p->snapshot) {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "invalid packet capture length %u, bigger than "
                            "snaplen of %d", hdr->caplen, p->snapshot);
                } else {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "invalid packet capture length %u, bigger than "
                            "maximum of %u", hdr->caplen,
                            max_snaplen_for_dlt(p->linktype));
@@ -621,7 +621,7 @@ pcap_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                                 * that would fail because we got EOF before
                                 * the read finished.
                                 */
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "truncated dump file; tried to read %u captured bytes, only got %zu",
                                    p->snapshot, amt_read);
                        }
@@ -645,7 +645,7 @@ pcap_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                                            PCAP_ERRBUF_SIZE, errno,
                                            "error reading dump file");
                                } else {
-                                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                            "truncated dump file; tried to read %u captured bytes, only got %zu",
                                            hdr->caplen, bytes_read);
                                }
@@ -697,7 +697,7 @@ pcap_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                                    PCAP_ERRBUF_SIZE, errno,
                                    "error reading dump file");
                        } else {
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "truncated dump file; tried to read %u captured bytes, only got %zu",
                                    hdr->caplen, amt_read);
                        }
@@ -802,14 +802,14 @@ pcap_dump_open(pcap_t *p, const char *fname)
         * link-layer type, so we can't use it.
         */
        if (!p->activated) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: not-yet-activated pcap_t passed to pcap_dump_open",
                    fname);
                return (NULL);
        }
        linktype = dlt_to_linktype(p->linktype);
        if (linktype == -1) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: link-layer type %d isn't supported in savefiles",
                    fname, p->linktype);
                return (NULL);
@@ -817,7 +817,7 @@ pcap_dump_open(pcap_t *p, const char *fname)
        linktype |= p->linktype_ext;
 
        if (fname == NULL) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "A null pointer was supplied as the file name");
                return NULL;
        }
@@ -884,7 +884,7 @@ pcap_dump_fopen(pcap_t *p, FILE *f)
 
        linktype = dlt_to_linktype(p->linktype);
        if (linktype == -1) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "stream: link-layer type %d isn't supported in savefiles",
                    p->linktype);
                return (NULL);
@@ -904,14 +904,14 @@ pcap_dump_open_append(pcap_t *p, const char *fname)
 
        linktype = dlt_to_linktype(p->linktype);
        if (linktype == -1) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "%s: link-layer type %d isn't supported in savefiles",
                    fname, linktype);
                return (NULL);
        }
 
        if (fname == NULL) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "A null pointer was supplied as the file name");
                return NULL;
        }
@@ -964,7 +964,7 @@ pcap_dump_open_append(pcap_t *p, const char *fname)
                        (void)fclose(f);
                        return (NULL);
                } else if (feof(f) && amt_read > 0) {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "%s: truncated pcap file header", fname);
                        (void)fclose(f);
                        return (NULL);
@@ -1000,7 +1000,7 @@ pcap_dump_open_append(pcap_t *p, const char *fname)
 
                case TCPDUMP_MAGIC:
                        if (p->opt.tstamp_precision != PCAP_TSTAMP_PRECISION_MICRO) {
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "%s: different time stamp precision, cannot append to file", fname);
                                (void)fclose(f);
                                return (NULL);
@@ -1009,7 +1009,7 @@ pcap_dump_open_append(pcap_t *p, const char *fname)
 
                case NSEC_TCPDUMP_MAGIC:
                        if (p->opt.tstamp_precision != PCAP_TSTAMP_PRECISION_NANO) {
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "%s: different time stamp precision, cannot append to file", fname);
                                (void)fclose(f);
                                return (NULL);
@@ -1018,7 +1018,7 @@ pcap_dump_open_append(pcap_t *p, const char *fname)
 
                case SWAPLONG(TCPDUMP_MAGIC):
                case SWAPLONG(NSEC_TCPDUMP_MAGIC):
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "%s: different byte order, cannot append to file", fname);
                        (void)fclose(f);
                        return (NULL);
@@ -1027,13 +1027,13 @@ pcap_dump_open_append(pcap_t *p, const char *fname)
                case SWAPLONG(KUZNETZOV_TCPDUMP_MAGIC):
                case NAVTEL_TCPDUMP_MAGIC:
                case SWAPLONG(NAVTEL_TCPDUMP_MAGIC):
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "%s: not a pcap file to which we can append", fname);
                        (void)fclose(f);
                        return (NULL);
 
                default:
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "%s: not a pcap file", fname);
                        (void)fclose(f);
                        return (NULL);
@@ -1044,20 +1044,20 @@ pcap_dump_open_append(pcap_t *p, const char *fname)
                 */
                if (ph.version_major != PCAP_VERSION_MAJOR ||
                    ph.version_minor != PCAP_VERSION_MINOR) {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "%s: version is %u.%u, cannot append to file", fname,
                            ph.version_major, ph.version_minor);
                        (void)fclose(f);
                        return (NULL);
                }
                if ((bpf_u_int32)linktype != ph.linktype) {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "%s: different linktype, cannot append to file", fname);
                        (void)fclose(f);
                        return (NULL);
                }
                if ((bpf_u_int32)p->snapshot != ph.snaplen) {
-                       pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                            "%s: different snaplen, cannot append to file", fname);
                        (void)fclose(f);
                        return (NULL);
index 92d00f802b1a4c1ff1147d3d53db202abc2e186e..6b36e38307aa4f46a5a0b4344448114396c159ef 100644 (file)
@@ -265,7 +265,7 @@ read_bytes(FILE *fp, void *buf, size_t bytes_to_read, int fail_on_eof,
                } else {
                        if (amt_read == 0 && !fail_on_eof)
                                return (0);     /* EOF */
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "truncated dump file; tried to read %zu bytes, only got %zu",
                            bytes_to_read, amt_read);
                }
@@ -301,7 +301,7 @@ read_block(FILE *fp, pcap_t *p, struct block_cursor *cursor, char *errbuf)
         */
        if (bhdr.total_length < sizeof(struct block_header) +
            sizeof(struct block_trailer)) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "block in pcapng dump file has a length of %u < %zu",
                    bhdr.total_length,
                    sizeof(struct block_header) + sizeof(struct block_trailer));
@@ -315,7 +315,7 @@ read_block(FILE *fp, pcap_t *p, struct block_cursor *cursor, char *errbuf)
                /*
                 * No.  Report that as an error.
                 */
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "block in pcapng dump file has a length of %u that is not a multiple of 4",
                    bhdr.total_length);
                return (-1);
@@ -332,13 +332,13 @@ read_block(FILE *fp, pcap_t *p, struct block_cursor *cursor, char *errbuf)
                void *bigger_buffer;
 
                if (bhdr.total_length > ps->max_blocksize) {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "pcapng block size %u > maximum %u", bhdr.total_length,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "pcapng block size %u > maximum %u", bhdr.total_length,
                            ps->max_blocksize);
                        return (-1);
                }
                bigger_buffer = realloc(p->buffer, bhdr.total_length);
                if (bigger_buffer == NULL) {
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "out of memory");
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE, "out of memory");
                        return (-1);
                }
                p->buffer = bigger_buffer;
@@ -369,7 +369,7 @@ read_block(FILE *fp, pcap_t *p, struct block_cursor *cursor, char *errbuf)
                /*
                 * No.
                 */
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "block total length in header and trailer don't match");
                return (-1);
        }
@@ -394,7 +394,7 @@ get_from_block_data(struct block_cursor *cursor, size_t chunk_size,
         * the block data.
         */
        if (cursor->data_remaining < chunk_size) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "block of type %u in pcapng dump file is too short",
                    cursor->block_type);
                return (NULL);
@@ -495,7 +495,7 @@ process_idb_options(pcap_t *p, struct block_cursor *cursor, uint64_t *tsresol,
 
                case OPT_ENDOFOPT:
                        if (opthdr->option_length != 0) {
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "Interface Description Block has opt_endofopt option with length %u != 0",
                                    opthdr->option_length);
                                return (-1);
@@ -504,13 +504,13 @@ process_idb_options(pcap_t *p, struct block_cursor *cursor, uint64_t *tsresol,
 
                case IF_TSRESOL:
                        if (opthdr->option_length != 1) {
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "Interface Description Block has if_tsresol option with length %u != 1",
                                    opthdr->option_length);
                                return (-1);
                        }
                        if (saw_tsresol) {
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "Interface Description Block has more than one if_tsresol option");
                                return (-1);
                        }
@@ -527,7 +527,7 @@ process_idb_options(pcap_t *p, struct block_cursor *cursor, uint64_t *tsresol,
                                         * Resolution is too high; 2^-{res}
                                         * won't fit in a 64-bit value.
                                         */
-                                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                            "Interface Description Block if_tsresol option resolution 2^-%u is too high",
                                            tsresol_shift);
                                        return (-1);
@@ -547,7 +547,7 @@ process_idb_options(pcap_t *p, struct block_cursor *cursor, uint64_t *tsresol,
                                         * the largest 64-bit unsigned
                                         * value is ~1.8*10^19).
                                         */
-                                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                            "Interface Description Block if_tsresol option resolution 10^-%u is too high",
                                            tsresol_opt);
                                        return (-1);
@@ -561,13 +561,13 @@ process_idb_options(pcap_t *p, struct block_cursor *cursor, uint64_t *tsresol,
 
                case IF_TSOFFSET:
                        if (opthdr->option_length != 8) {
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "Interface Description Block has if_tsoffset option with length %u != 8",
                                    opthdr->option_length);
                                return (-1);
                        }
                        if (saw_tsoffset) {
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "Interface Description Block has more than one if_tsoffset option");
                                return (-1);
                        }
@@ -644,7 +644,7 @@ add_interface(pcap_t *p, struct block_cursor *cursor, char *errbuf)
                                 * possible 32-bit power of 2, as we do
                                 * size doubling.
                                 */
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "more than %u interfaces in the file",
                                    0x80000000U);
                                return (0);
@@ -675,7 +675,7 @@ add_interface(pcap_t *p, struct block_cursor *cursor, char *errbuf)
                                 * (unsigned) value divided by
                                 * sizeof (struct pcap_ng_if).
                                 */
-                               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                                    "more than %u interfaces in the file",
                                    0xFFFFFFFFU / ((u_int)sizeof (struct pcap_ng_if)));
                                return (0);
@@ -687,7 +687,7 @@ add_interface(pcap_t *p, struct block_cursor *cursor, char *errbuf)
                         * We ran out of memory.
                         * Give up.
                         */
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "out of memory for per-interface information (%u interfaces)",
                            ps->ifcount);
                        return (0);
@@ -857,7 +857,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
         * Check the sanity of the total length.
         */
        if (total_length < sizeof(*bhdrp) + sizeof(*shbp) + sizeof(struct block_trailer)) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "Section Header Block in pcapng dump file has a length of %u < %zu",
                    total_length,
                    sizeof(*bhdrp) + sizeof(*shbp) + sizeof(struct block_trailer));
@@ -869,7 +869,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
         * Make sure it's not too big.
         */
        if (total_length > INITIAL_MAX_BLOCKSIZE) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "pcapng block size %u > maximum %u",
                    total_length, INITIAL_MAX_BLOCKSIZE);
                *err = 1;
@@ -903,7 +903,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
                break;
 
        default:
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "unknown time stamp resolution %u", precision);
                free(p);
                *err = 1;
@@ -933,7 +933,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
                p->bufsize = total_length;
        p->buffer = malloc(p->bufsize);
        if (p->buffer == NULL) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE, "out of memory");
+               snprintf(errbuf, PCAP_ERRBUF_SIZE, "out of memory");
                free(p);
                *err = 1;
                return (NULL);
@@ -969,7 +969,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
        /* currently only SHB version 1.0 is supported */
        if (! (shbp->major_version == PCAP_NG_VERSION_MAJOR &&
               shbp->minor_version == PCAP_NG_VERSION_MINOR)) {
-               pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(errbuf, PCAP_ERRBUF_SIZE,
                    "unsupported pcapng savefile version %u.%u",
                    shbp->major_version, shbp->minor_version);
                goto fail;
@@ -992,7 +992,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
                status = read_block(fp, p, &cursor, errbuf);
                if (status == 0) {
                        /* EOF - no IDB in this file */
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "the capture file has no Interface Description Blocks");
                        goto fail;
                }
@@ -1034,7 +1034,7 @@ pcap_ng_check_header(const uint8_t *magic, FILE *fp, u_int precision,
                         * not valid, as we don't know what link-layer
                         * encapsulation the packet has.
                         */
-                       pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+                       snprintf(errbuf, PCAP_ERRBUF_SIZE,
                            "the capture file has a packet block before any Interface Description Blocks");
                        goto fail;
 
@@ -1238,7 +1238,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                         * interfaces?
                         */
                        if (p->linktype != idbp->linktype) {
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "an interface has a type %u different from the type of the first interface",
                                    idbp->linktype);
                                return (-1);
@@ -1250,7 +1250,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                         */
                        if ((bpf_u_int32)p->snapshot !=
                            pcap_adjust_snapshot(p->linktype, idbp->snaplen)) {
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "an interface has a snapshot length %u different from the type of the first interface",
                                    idbp->snaplen);
                                return (-1);
@@ -1302,7 +1302,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                                /*
                                 * Byte order changes.
                                 */
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "the file has sections with different byte orders");
                                return (-1);
 
@@ -1310,7 +1310,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                                /*
                                 * Not a valid SHB.
                                 */
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "the file has a section with a bad byte order magic field");
                                return (-1);
                        }
@@ -1320,7 +1320,7 @@ pcap_ng_next_packet(pcap_t *p, struct pcap_pkthdr *hdr, u_char **data)
                         * we handle.
                         */
                        if (shbp->major_version != PCAP_NG_VERSION_MAJOR) {
-                               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+                               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                                    "unknown pcapng savefile major version number %u",
                                    shbp->major_version);
                                return (-1);
@@ -1354,14 +1354,14 @@ found:
                /*
                 * Yes.  Fail.
                 */
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "a packet arrived on interface %u, but there's no Interface Description Block for that interface",
                    interface_id);
                return (-1);
        }
 
        if (hdr->caplen > (bpf_u_int32)p->snapshot) {
-               pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
+               snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "invalid packet capture length %u, bigger than "
                    "snaplen of %d", hdr->caplen, p->snapshot);
                return (-1);
index 8909c3a0880d64f847468c707d1ec26b536a18db..bd3d6cc2b8723bfb5cb9a4a6631be09915c15ec1 100644 (file)
@@ -197,7 +197,7 @@ int sock_init(char *errbuf, int errbuflen)
                    WINSOCK_MINOR_VERSION), &wsaData) != 0)
                {
                        if (errbuf)
-                               pcap_snprintf(errbuf, errbuflen, "Failed to initialize Winsock\n");
+                               snprintf(errbuf, errbuflen, "Failed to initialize Winsock\n");
 
                        WSACleanup();
 
@@ -371,7 +371,7 @@ SOCKET sock_open(struct addrinfo *addrinfo, int server, int nconn, char *errbuf,
                            (char *)&on, sizeof (int)) == -1)
                        {
                                if (errbuf)
-                                       pcap_snprintf(errbuf, errbuflen, "setsockopt(IPV6_V6ONLY)");
+                                       snprintf(errbuf, errbuflen, "setsockopt(IPV6_V6ONLY)");
                                closesocket(sock);
                                return INVALID_SOCKET;
                        }
@@ -432,7 +432,7 @@ SOCKET sock_open(struct addrinfo *addrinfo, int server, int nconn, char *errbuf,
                                /* Returns the numeric address of the host that triggered the error */
                                sock_getascii_addrport((struct sockaddr_storage *) tempaddrinfo->ai_addr, TmpBuffer, sizeof(TmpBuffer), NULL, 0, NI_NUMERICHOST, TmpBuffer, sizeof(TmpBuffer));
 
-                               pcap_snprintf(errbufptr, bufspaceleft,
+                               snprintf(errbufptr, bufspaceleft,
                                    "Is the server properly installed on %s?  %s", TmpBuffer, SocketErrorMessage);
 
                                /* In case more then one 'connect' fails, we manage to keep all the error messages */
@@ -523,52 +523,52 @@ get_gai_errstring(char *errbuf, int errbuflen, const char *prefix, int err,
        char hostport[PCAP_ERRBUF_SIZE];
 
        if (hostname != NULL && portname != NULL)
-               pcap_snprintf(hostport, PCAP_ERRBUF_SIZE, "%s:%s",
+               snprintf(hostport, PCAP_ERRBUF_SIZE, "%s:%s",
                    hostname, portname);
        else if (hostname != NULL)
-               pcap_snprintf(hostport, PCAP_ERRBUF_SIZE, "%s",
+               snprintf(hostport, PCAP_ERRBUF_SIZE, "%s",
                    hostname);
        else if (portname != NULL)
-               pcap_snprintf(hostport, PCAP_ERRBUF_SIZE, ":%s",
+               snprintf(hostport, PCAP_ERRBUF_SIZE, ":%s",
                    portname);
        else
-               pcap_snprintf(hostport, PCAP_ERRBUF_SIZE, "<no host or port!>");
+               snprintf(hostport, PCAP_ERRBUF_SIZE, "<no host or port!>");
        switch (err)
        {
 #ifdef EAI_ADDRFAMILY
                case EAI_ADDRFAMILY:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sAddress family for %s not supported",
                            prefix, hostport);
                        break;
 #endif
 
                case EAI_AGAIN:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%s%s could not be resolved at this time",
                            prefix, hostport);
                        break;
 
                case EAI_BADFLAGS:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sThe ai_flags parameter for looking up %s had an invalid value",
                            prefix, hostport);
                        break;
 
                case EAI_FAIL:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sA non-recoverable error occurred when attempting to resolve %s",
                            prefix, hostport);
                        break;
 
                case EAI_FAMILY:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sThe address family for looking up %s was not recognized",
                            prefix, hostport);
                        break;
 
                case EAI_MEMORY:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sOut of memory trying to allocate storage when looking up %s",
                            prefix, hostport);
                        break;
@@ -585,26 +585,26 @@ get_gai_errstring(char *errbuf, int errbuflen, const char *prefix, int err,
                 */
 #if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME
                case EAI_NODATA:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sNo address associated with %s",
                            prefix, hostport);
                        break;
 #endif
 
                case EAI_NONAME:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sThe host name %s couldn't be resolved",
                            prefix, hostport);
                        break;
 
                case EAI_SERVICE:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sThe service value specified when looking up %s as not recognized for the socket type",
                            prefix, hostport);
                        break;
 
                case EAI_SOCKTYPE:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sThe socket type specified when looking up %s as not recognized",
                            prefix, hostport);
                        break;
@@ -614,7 +614,7 @@ get_gai_errstring(char *errbuf, int errbuflen, const char *prefix, int err,
                        /*
                         * Assumed to be UN*X.
                         */
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sAn error occurred when looking up %s: %s",
                            prefix, hostport, pcap_strerror(errno));
                        break;
@@ -622,7 +622,7 @@ get_gai_errstring(char *errbuf, int errbuflen, const char *prefix, int err,
 
 #ifdef EAI_BADHINTS
                case EAI_BADHINTS:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sInvalid value for hints when looking up %s",
                            prefix, hostport);
                        break;
@@ -630,7 +630,7 @@ get_gai_errstring(char *errbuf, int errbuflen, const char *prefix, int err,
 
 #ifdef EAI_PROTOCOL
                case EAI_PROTOCOL:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sResolved protocol when looking up %s is unknown",
                            prefix, hostport);
                        break;
@@ -638,14 +638,14 @@ get_gai_errstring(char *errbuf, int errbuflen, const char *prefix, int err,
 
 #ifdef EAI_OVERFLOW
                case EAI_OVERFLOW:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sArgument buffer overflow when looking up %s",
                            prefix, hostport);
                        break;
 #endif
 
                default:
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "%sgetaddrinfo() error %d when looking up %s",
                            prefix, err, hostport);
                        break;
@@ -722,7 +722,7 @@ int sock_initaddress(const char *host, const char *port,
            ((*addrinfo)->ai_family != PF_INET6))
        {
                if (errbuf)
-                       pcap_snprintf(errbuf, errbuflen, "getaddrinfo(): socket type not supported");
+                       snprintf(errbuf, errbuflen, "getaddrinfo(): socket type not supported");
                freeaddrinfo(*addrinfo);
                *addrinfo = NULL;
                return -1;
@@ -735,7 +735,7 @@ int sock_initaddress(const char *host, const char *port,
            (sock_ismcastaddr((*addrinfo)->ai_addr) == 0))
        {
                if (errbuf)
-                       pcap_snprintf(errbuf, errbuflen, "getaddrinfo(): multicast addresses are not valid when using TCP streams");
+                       snprintf(errbuf, errbuflen, "getaddrinfo(): multicast addresses are not valid when using TCP streams");
                freeaddrinfo(*addrinfo);
                *addrinfo = NULL;
                return -1;
@@ -781,7 +781,7 @@ int sock_send(SOCKET sock, SSL *ssl _U_NOSSL_, const char *buffer, size_t size,
        {
                if (errbuf)
                {
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "Can't send more than %u bytes with sock_send",
                            INT_MAX);
                }
@@ -912,7 +912,7 @@ int sock_bufferize(const char *buffer, int size, char *tempbuf, int *offset, int
        if ((*offset + size) > totsize)
        {
                if (errbuf)
-                       pcap_snprintf(errbuf, errbuflen, "Not enough space in the temporary send buffer.");
+                       snprintf(errbuf, errbuflen, "Not enough space in the temporary send buffer.");
                return -1;
        }
 
@@ -986,7 +986,7 @@ int sock_recv(SOCKET sock, SSL *ssl _U_NOSSL_, void *buffer, size_t size,
        {
                if (errbuf)
                {
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "Can't read more than %u bytes with sock_recv",
                            INT_MAX);
                }
@@ -1041,7 +1041,7 @@ int sock_recv(SOCKET sock, SSL *ssl _U_NOSSL_, void *buffer, size_t size,
                                 */
                                if (errbuf)
                                {
-                                       pcap_snprintf(errbuf, errbuflen,
+                                       snprintf(errbuf, errbuflen,
                                            "The other host terminated the connection.");
                                }
                                return -1;
@@ -1092,7 +1092,7 @@ int sock_recv_dgram(SOCKET sock, SSL *ssl _U_NOSSL_, void *buffer, size_t size,
        {
                if (errbuf)
                {
-                       pcap_snprintf(errbuf, errbuflen,
+                       snprintf(errbuf, errbuflen,
                            "Can't read more than %u bytes with sock_recv_dgram",
                            INT_MAX);
                }
@@ -1103,7 +1103,7 @@ int sock_recv_dgram(SOCKET sock, SSL *ssl _U_NOSSL_, void *buffer, size_t size,
        // TODO: DTLS
        if (ssl)
        {
-               pcap_snprintf(errbuf, errbuflen, "DTLS not implemented yet");
+               snprintf(errbuf, errbuflen, "DTLS not implemented yet");
                return -1;
        }
 #endif
@@ -1180,7 +1180,7 @@ int sock_recv_dgram(SOCKET sock, SSL *ssl _U_NOSSL_, void *buffer, size_t size,
                 * Report this as an error, as the Microsoft documentation
                 * implies we'd do in a similar case on Windows.
                 */
-               pcap_snprintf(errbuf, errbuflen, "recv(): Message too long");
+               snprintf(errbuf, errbuflen, "recv(): Message too long");
                return -1;
        }
 #endif /* HAVE_STRUCT_MSGHDR_MSG_FLAGS */
@@ -1384,7 +1384,7 @@ int sock_check_hostlist(char *hostlist, const char *sep, struct sockaddr_storage
                         * the host wasn't in the list.
                         */
                        if (errbuf)
-                               pcap_snprintf(errbuf, errbuflen, "The host is not in the allowed host list. Connection refused.");
+                               snprintf(errbuf, errbuflen, "The host is not in the allowed host list. Connection refused.");
                        return -1;
                }
        }
@@ -1654,7 +1654,7 @@ int sock_present2network(const char *address, struct sockaddr_storage *sockaddr,
                freeaddrinfo(addrinfo);
 
                if (errbuf)
-                       pcap_snprintf(errbuf, errbuflen, "More than one socket requested; using the first one returned");
+                       snprintf(errbuf, errbuflen, "More than one socket requested; using the first one returned");
                return -2;
        }
 
index 21cb3f905a2fd3c6df1afab63336064e6ef8c00c..8454ebd9fb1a2619e0e5e61aee40565bebf28d77 100644 (file)
@@ -75,7 +75,7 @@ int ssl_init_once(int is_server, int enable_compression, char *errbuf, size_t er
        ctx = SSL_CTX_new(meth);
        if (! ctx)
        {
-               pcap_snprintf(errbuf, errbuflen, "Cannot get a new SSL context: %s", ERR_error_string(ERR_get_error(), NULL));
+               snprintf(errbuf, errbuflen, "Cannot get a new SSL context: %s", ERR_error_string(ERR_get_error(), NULL));
                goto die;
        }
 
@@ -86,14 +86,14 @@ int ssl_init_once(int is_server, int enable_compression, char *errbuf, size_t er
                char const *certfile = ssl_certfile[0] ? ssl_certfile : "cert.pem";
                if (1 != SSL_CTX_use_certificate_file(ctx, certfile, SSL_FILETYPE_PEM))
                {
-                       pcap_snprintf(errbuf, errbuflen, "Cannot read certificate file %s: %s", certfile, ERR_error_string(ERR_get_error(), NULL));
+                       snprintf(errbuf, errbuflen, "Cannot read certificate file %s: %s", certfile, ERR_error_string(ERR_get_error(), NULL));
                        goto die;
                }
 
                char const *keyfile = ssl_keyfile[0] ? ssl_keyfile : "key.pem";
                if (1 != SSL_CTX_use_PrivateKey_file(ctx, keyfile, SSL_FILETYPE_PEM))
                {
-                       pcap_snprintf(errbuf, errbuflen, "Cannot read private key file %s: %s", keyfile, ERR_error_string(ERR_get_error(), NULL));
+                       snprintf(errbuf, errbuflen, "Cannot read private key file %s: %s", keyfile, ERR_error_string(ERR_get_error(), NULL));
                        goto die;
                }
        }
@@ -103,7 +103,7 @@ int ssl_init_once(int is_server, int enable_compression, char *errbuf, size_t er
                {
                        if (! SSL_CTX_load_verify_locations(ctx, ssl_rootfile, 0))
                        {
-                               pcap_snprintf(errbuf, errbuflen, "Cannot read CA list from %s", ssl_rootfile);
+                               snprintf(errbuf, errbuflen, "Cannot read CA list from %s", ssl_rootfile);
                                goto die;
                        }
                }
@@ -116,7 +116,7 @@ int ssl_init_once(int is_server, int enable_compression, char *errbuf, size_t er
 #if 0
        if (! RAND_load_file(RANDOM, 1024*1024))
        {
-               pcap_snprintf(errbuf, errbuflen, "Cannot init random");
+               snprintf(errbuf, errbuflen, "Cannot init random");
                goto die;
        }
 
@@ -144,13 +144,13 @@ SSL *ssl_promotion(int is_server, SOCKET s, char *errbuf, size_t errbuflen)
 
        if (is_server) {
                if (SSL_accept(ssl) <= 0) {
-                       pcap_snprintf(errbuf, errbuflen, "SSL_accept(): %s",
+                       snprintf(errbuf, errbuflen, "SSL_accept(): %s",
                                        ERR_error_string(ERR_get_error(), NULL));
                        return NULL;
                }
        } else {
                if (SSL_connect(ssl) <= 0) {
-                       pcap_snprintf(errbuf, errbuflen, "SSL_connect(): %s",
+                       snprintf(errbuf, errbuflen, "SSL_connect(): %s",
                                        ERR_error_string(ERR_get_error(), NULL));
                        return NULL;
                }
@@ -201,7 +201,7 @@ int ssl_send(SSL *ssl, char const *buffer, int size, char *errbuf, size_t errbuf
                        if (errno == ECONNRESET || errno == EPIPE) return -2;
 #endif
                }
-               pcap_snprintf(errbuf, errbuflen, "SSL_write(): %s",
+               snprintf(errbuf, errbuflen, "SSL_write(): %s",
                    ERR_error_string(ERR_get_error(), NULL));
                return -1;
        }
@@ -225,7 +225,7 @@ int ssl_recv(SSL *ssl, char *buffer, int size, char *errbuf, size_t errbuflen)
                else
                {
                        // Should not happen
-                       pcap_snprintf(errbuf, errbuflen, "SSL_read(): %s",
+                       snprintf(errbuf, errbuflen, "SSL_read(): %s",
                            ERR_error_string(ERR_get_error(), NULL));
                        return -2;
                }