]> The Tcpdump Group git mirrors - libpcap/commitdiff
Get rid of the last SOCK_DEBUG_MESSAGE() calls.
authorGuy Harris <[email protected]>
Sun, 13 Jan 2019 04:31:54 +0000 (20:31 -0800)
committerGuy Harris <[email protected]>
Sun, 13 Jan 2019 04:31:54 +0000 (20:31 -0800)
Treat a failure to get the socket buffer size as an error; we were just
blithely driving on and using the variable into which the size *hadn't*
been put.  That means that our caller will be handed the error message;
we presume they do something with it, so that we don't need to print it
as a debugging message.

In other cases, we already were reporting an error and providing the
error message; the same applies there.

pcap-rpcap.c
sockutils.h

index 61a73957f9d2fa7b0a341f49c7b1bd960cf8c673..88c4e75f095c92fb06e7d78e66caa6af69089666 100644 (file)
@@ -1307,7 +1307,7 @@ static int pcap_startcapture_remote(pcap_t *fp)
        if (res == -1)
        {
                sock_geterror("pcap_startcapture_remote()", fp->errbuf, PCAP_ERRBUF_SIZE);
-               SOCK_DEBUG_MESSAGE(fp->errbuf);
+               goto error;
        }
 
        /*
@@ -2857,7 +2857,6 @@ SOCKET pcap_remoteact_accept_ex(const char *address, const char *port, const cha
        {
                if (sock_initaddress(address, RPCAP_DEFAULT_NETPORT_ACTIVE, &hints, &addrinfo, errbuf, PCAP_ERRBUF_SIZE) == -1)
                {
-                       SOCK_DEBUG_MESSAGE(errbuf);
                        return (SOCKET)-2;
                }
        }
@@ -2865,7 +2864,6 @@ SOCKET pcap_remoteact_accept_ex(const char *address, const char *port, const cha
        {
                if (sock_initaddress(address, port, &hints, &addrinfo, errbuf, PCAP_ERRBUF_SIZE) == -1)
                {
-                       SOCK_DEBUG_MESSAGE(errbuf);
                        return (SOCKET)-2;
                }
        }
@@ -2873,7 +2871,6 @@ SOCKET pcap_remoteact_accept_ex(const char *address, const char *port, const cha
 
        if ((sockmain = sock_open(addrinfo, SOCKOPEN_SERVER, 1, errbuf, PCAP_ERRBUF_SIZE)) == INVALID_SOCKET)
        {
-               SOCK_DEBUG_MESSAGE(errbuf);
                freeaddrinfo(addrinfo);
                return (SOCKET)-2;
        }
index f2c56ac6cc5f21ff1e607cf8dfb836b75051c876..e748662e3ab84441f0b9daf6a7e103f26fad4429 100644 (file)
@@ -81,35 +81,6 @@ int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD,
  * \{
  */
 
-/*
- * \brief DEBUG facility: it prints an error message on the screen (stderr)
- *
- * This macro prints the error on the standard error stream (stderr);
- * if we are working in debug mode (i.e. there is no NDEBUG defined) and we are in
- * Microsoft Visual C++, the error message will appear on the MSVC console as well.
- *
- * When NDEBUG is defined, this macro is empty.
- *
- * \param msg: the message you want to print.
- *
- * \param expr: 'false' if you want to abort the program, 'true' it you want
- * to print the message and continue.
- *
- * \return No return values.
- */
-#ifdef NDEBUG
-  #define SOCK_DEBUG_MESSAGE(msg) ((void)0)
-#else
-  #if (defined(_WIN32) && defined(_MSC_VER))
-    #include <crtdbg.h>                                /* for _CrtDbgReport */
-    /* Use MessageBox(NULL, msg, "warning", MB_OK)' instead of the other calls if you want to debug a Win32 service */
-    /* Remember to activate the 'allow service to interact with desktop' flag of the service */
-    #define SOCK_DEBUG_MESSAGE(msg) { _CrtDbgReport(_CRT_WARN, NULL, 0, NULL, "%s\n", msg); fprintf(stderr, "%s\n", msg); }
-  #else
-    #define SOCK_DEBUG_MESSAGE(msg) { fprintf(stderr, "%s\n", msg); }
-  #endif
-#endif
-
 /****************************************************
  *                                                  *
  * Exported functions / definitions                 *