X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libevent%2Flistener.c;h=9941e1d8f69b482e36f6daf6f499a22b6979f387;hb=d7c6070cde285ce17d1b1a7dc32cfd956c8c553e;hp=d0911bdb8dad1b5bfbe3354354029a0510ce22ef;hpb=313b5f94348618d65523c1d8bde1fba9988f040a;p=netatalk.git diff --git a/libevent/listener.c b/libevent/listener.c index d0911bdb..9941e1d8 100644 --- a/libevent/listener.c +++ b/libevent/listener.c @@ -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 @@ -29,6 +29,10 @@ #include "event2/event-config.h" #ifdef WIN32 +#ifndef _WIN32_WINNT +/* Minimum required for InitializeCriticalSectionAndSpinCount */ +#define _WIN32_WINNT 0x0403 +#endif #include #include #include @@ -386,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);