From 4e99e63e1ffeedd08a29cef0b2b6efde3a81939c Mon Sep 17 00:00:00 2001 From: Yao Yue Date: Thu, 12 Sep 2019 11:57:45 -0700 Subject: [PATCH] fix a bug and change how check is found (#214) --- CMakeLists.txt | 20 +++++++++----------- src/channel/cc_tcp.c | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2eb9eef2..97aefc826 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,16 +153,16 @@ endif(COVERAGE) # test dependencies include(FindPackageHandleStandardArgs) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake") - -find_package(PkgConfig QUIET) - -if(PKG_CONFIG_FOUND) - pkg_check_modules(CHECK QUIET check>=0.10) -endif() - +find_package(Check) if(NOT CHECK_FOUND) - find_package(Check QUIET 0.10) -endif() + message(WARNING "Check is required to build and run tests") +endif(NOT CHECK_FOUND) +if(CHECK_FOUND) + check_symbol_exists(ck_assert_int_eq check.h CHECK_WORKING) + if(NOT CHECK_WORKING) + message(WARNING "Check version too old to build tests") + endif(NOT CHECK_WORKING) +endif(CHECK_FOUND) if (HAVE_ITT_INSTRUMENTATION) if(PKG_CONFIG_FOUND) @@ -195,7 +195,6 @@ if(CHECK_FOUND) add_subdirectory(test) endif(CHECK_FOUND) - if(HAVE_RUST) enable_language(Rust) include(CMakeCargo) @@ -203,7 +202,6 @@ if(HAVE_RUST) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_RUST=1") endif() - ################### # print a summary # ################### diff --git a/src/channel/cc_tcp.c b/src/channel/cc_tcp.c index 325557274..25f6a8108 100644 --- a/src/channel/cc_tcp.c +++ b/src/channel/cc_tcp.c @@ -467,7 +467,7 @@ tcp_reject_all(struct tcp_conn *sc) log_error("accept on sd %d failed: %s", sc->sd, strerror(errno)); INCR(tcp_metrics, tcp_reject_ex); - return -1; + return; } ret = close(sd);