]> arthur.barton.de Git - netatalk.git/blobdiff - libevent/listener.c
Merge 2-2
[netatalk.git] / libevent / listener.c
index 5db2cb733b313a7945aeb82ccfcdb2fdba63d3d4..9941e1d8f69b482e36f6daf6f499a22b6979f387 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009-2010 Niels Provos, Nick Mathewson
+ * Copyright (c) 2009-2012 Niels Provos, Nick Mathewson
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -390,6 +390,12 @@ listener_read_cb(evutil_socket_t fd, short what, void *p)
                evutil_socket_t new_fd = accept(fd, (struct sockaddr*)&ss, &socklen);
                if (new_fd < 0)
                        break;
+               if (socklen == 0) {
+                       /* This can happen with some older linux kernels in
+                        * response to nmap. */
+                       evutil_closesocket(new_fd);
+                       continue;
+               }
 
                if (!(lev->flags & LEV_OPT_LEAVE_SOCKETS_BLOCKING))
                        evutil_make_socket_nonblocking(new_fd);