swrap: Do not log if we are over the limit in find_socket_info_index()
authorAndreas Schneider <asn@samba.org>
Tue, 13 Nov 2018 17:44:39 +0000 (18:44 +0100)
committerAndreas Schneider <asn@samba.org>
Tue, 13 Nov 2018 18:15:51 +0000 (19:15 +0100)
There are applications which do:

    for (fd = 0; fd <= getdtablesize(); fd++) {
        close(fd)
    };

This produced millions of error messsages.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
src/socket_wrapper.c

index e02f0838216ba43faa23c6f3ece22c848546c085..df70df5008d86dbac9aa759adba3c412d2d24550 100644 (file)
@@ -1540,11 +1540,23 @@ static int find_socket_info_index(int fd)
        }
 
        if ((size_t)fd >= socket_fds_max) {
+               /*
+                * Do not add a log here as some applications do stupid things
+                * like:
+                *
+                *     for (fd = 0; fd <= getdtablesize(); fd++) {
+                *         close(fd)
+                *     };
+                *
+                * This would produce millions of lines of debug messages.
+                */
+#if 0
                SWRAP_LOG(SWRAP_LOG_ERROR,
-                         "The max socket index limit of %zu has been reached, "
-                         "trying to add %d",
-                         socket_fds_max,
-                         fd);
+                         "Looking for a socket info for the fd %d is over the "
+                         "max socket index limit of %zu.",
+                         fd,
+                         socket_fds_max);
+#endif
                return -1;
        }