From: Nick Mathewson Date: Thu, 26 Jul 2012 14:09:13 +0000 (-0400) Subject: Merge remote-tracking branch 'origin/patches-2.0' X-Git-Tag: release-2.1.2-alpha~78 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7ef04e4b4838f011ea13a0ca13b0ef5263e9362b;p=libevent Merge remote-tracking branch 'origin/patches-2.0' Conflicts: configure.in test/regress_buffer.c test/regress_dns.c --- 7ef04e4b4838f011ea13a0ca13b0ef5263e9362b diff --cc configure.in index f1972bf6,70dc29cd..89494b4d --- a/configure.in +++ b/configure.in @@@ -186,41 -165,27 +186,43 @@@ AC_SUBST(EV_LIB_WS32 AC_SUBST(EV_LIB_GDI) AC_SUBST(OPENSSL_LIBADD) -AC_CHECK_HEADERS([openssl/bio.h]) +AC_SYS_LARGEFILE -if test "$enable_openssl" = "yes"; then -save_LIBS="$LIBS" -LIBS="" -OPENSSL_LIBS="" -have_openssl=no -AC_SEARCH_LIBS([SSL_new], [ssl], - [have_openssl=yes - OPENSSL_LIBS="$LIBS -lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD" - AC_DEFINE(HAVE_OPENSSL, 1, [Define if the system has openssl])], - [have_openssl=no], - [-lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD]) -LIBS="$save_LIBS" -AC_SUBST(OPENSSL_LIBS) -fi +LIBEVENT_OPENSSL dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h stdarg.h inttypes.h stdint.h stddef.h poll.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h sys/param.h sys/ioctl.h sys/select.h sys/devpoll.h port.h netinet/in.h netinet/in6.h sys/socket.h sys/uio.h arpa/inet.h sys/eventfd.h sys/mman.h sys/sendfile.h sys/wait.h netdb.h]) -AC_CHECK_HEADERS([sys/stat.h]) +AC_CHECK_HEADERS([ \ + arpa/inet.h \ + fcntl.h \ + ifaddrs.h \ + mach/mach_time.h \ + netdb.h \ + netinet/in.h \ + netinet/in6.h \ + netinet/tcp.h \ + poll.h \ + port.h \ + stdarg.h \ + stddef.h \ + sys/devpoll.h \ + sys/epoll.h \ + sys/event.h \ + sys/eventfd.h \ + sys/ioctl.h \ + sys/mman.h \ + sys/param.h \ + sys/queue.h \ + sys/resource.h \ + sys/select.h \ + sys/sendfile.h \ + sys/socket.h \ ++ sys/stat.h \ + sys/time.h \ + sys/timerfd.h \ + sys/uio.h \ + sys/wait.h \ +]) ++ AC_CHECK_HEADERS(sys/sysctl.h, [], [], [ #ifdef HAVE_SYS_PARAM_H #include @@@ -318,46 -283,9 +320,47 @@@ AC_C_INLIN AC_HEADER_TIME dnl Checks for library functions. -AC_CHECK_FUNCS([gettimeofday vasprintf fcntl clock_gettime strtok_r strsep]) -AC_CHECK_FUNCS([getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random arc4random_buf issetugid geteuid getegid getprotobynumber setenv unsetenv putenv sysctl]) -AC_CHECK_FUNCS([umask]) +AC_CHECK_FUNCS([ \ + accept4 \ + arc4random \ + arc4random_buf \ + clock_gettime \ + eventfd \ + epoll_create1 \ + fcntl \ + getegid \ + geteuid \ + getifaddrs \ + getnameinfo \ + getprotobynumber \ + gettimeofday \ + inet_aton \ + inet_ntop \ + inet_pton \ + issetugid \ + mach_absolute_time \ + mmap \ + nanosleep \ + pipe \ + pipe2 \ + putenv \ + sendfile \ + setenv \ + setrlimit \ + sigaction \ + signal \ + splice \ + strlcpy \ + strsep \ + strtok_r \ + strtoll \ + sysctl \ + timerfd_create \ ++ umask \ + unsetenv \ + usleep \ + vasprintf \ +]) AC_CACHE_CHECK( [for getaddrinfo], diff --cc test/regress_buffer.c index d94a8b37,99a8c0ea..365b0c37 --- a/test/regress_buffer.c +++ b/test/regress_buffer.c @@@ -1273,15 -1076,8 +1275,17 @@@ test_evbuffer_ptr_set(void *ptr struct evbuffer_ptr pos; struct evbuffer_iovec v[1]; + tt_assert(buf); + + tt_int_op(evbuffer_get_length(buf), ==, 0); + + tt_assert(evbuffer_ptr_set(buf, &pos, 0, EVBUFFER_PTR_SET) == 0); + tt_assert(pos.pos == 0); + tt_assert(evbuffer_ptr_set(buf, &pos, 1, EVBUFFER_PTR_ADD) == -1); + tt_assert(pos.pos == -1); + tt_assert(evbuffer_ptr_set(buf, &pos, 1, EVBUFFER_PTR_SET) == -1); + tt_assert(pos.pos == -1); + /* create some chains */ evbuffer_reserve_space(buf, 5000, v, 1); v[0].iov_len = 5000; @@@ -1331,18 -1125,9 +1335,21 @@@ test_evbuffer_search(void *ptr struct evbuffer *tmp = evbuffer_new(); struct evbuffer_ptr pos, end; + tt_assert(buf); + tt_assert(tmp); + + pos = evbuffer_search(buf, "x", 1, NULL); + tt_int_op(pos.pos, ==, -1); + tt_assert(evbuffer_ptr_set(buf, &pos, 0, EVBUFFER_PTR_SET) == 0); + pos = evbuffer_search(buf, "x", 1, &pos); + tt_int_op(pos.pos, ==, -1); + tt_assert(evbuffer_ptr_set(buf, &pos, 0, EVBUFFER_PTR_SET) == 0); + pos = evbuffer_search_range(buf, "x", 1, &pos, &pos); + tt_int_op(pos.pos, ==, -1); + tt_assert(evbuffer_ptr_set(buf, &pos, 0, EVBUFFER_PTR_SET) == 0); + pos = evbuffer_search_range(buf, "x", 1, &pos, NULL); + tt_int_op(pos.pos, ==, -1); + /* set up our chains */ evbuffer_add_printf(tmp, "hello"); /* 5 chars */ evbuffer_add_buffer(buf, tmp); diff --cc test/regress_dns.c index 8f853253,557a63d6..cfb32552 --- a/test/regress_dns.c +++ b/test/regress_dns.c @@@ -1712,7 -1707,8 +1714,8 @@@ testleak_cleanup(const struct testcase_ { int ok = 0; struct testleak_env_t *env = env_; + tt_assert(env); -#ifdef _EVENT_DISABLE_DEBUG_MODE +#ifdef EVENT__DISABLE_DEBUG_MODE tt_int_op(allocated_chunks, ==, 0); #else /* FIXME: that's `1' because of event_debug_map_HT_GROW */ diff --cc test/regress_main.c index 415cbb00,e32afff7..3dc8be89 --- a/test/regress_main.c +++ b/test/regress_main.c @@@ -59,8 -58,11 +59,11 @@@ #endif #include -#ifdef _EVENT_HAVE_SYS_STAT_H ++#ifdef EVENT__HAVE_SYS_STAT_H + #include + #endif -#ifndef WIN32 +#ifndef _WIN32 #include #include #include @@@ -115,16 -118,17 +118,19 @@@ static void dnslogcb(int w, const char TT_BLATHER(("%s", m)); } -/* creates a temporary file with the data in it */ +/* creates a temporary file with the data in it. If *filename_out gets set, + * the caller should try to unlink it. */ int -regress_make_tmpfile(const void *data, size_t datalen) +regress_make_tmpfile(const void *data, size_t datalen, char **filename_out) { -#ifndef WIN32 +#ifndef _WIN32 char tmpfilename[32]; int fd; + *filename_out = NULL; strcpy(tmpfilename, "/tmp/eventtmp.XXXXXX"); -#ifdef _EVENT_HAVE_UMASK ++#ifdef EVENT__HAVE_UMASK + umask(0077); + #endif fd = mkstemp(tmpfilename); if (fd == -1) return (-1);