diff options
author | Simon Rettberg | 2014-01-09 16:09:39 +0100 |
---|---|---|
committer | Simon Rettberg | 2014-01-09 16:09:39 +0100 |
commit | 6d79f1645411f2074225e22413536d0e2200b85b (patch) | |
tree | 23fa80f1592da4d45e05916125f6cba0ece38866 | |
parent | [SERVER] Fix old image deletion, make image_load a bit nicer (diff) | |
download | dnbd3-6d79f1645411f2074225e22413536d0e2200b85b.tar.gz dnbd3-6d79f1645411f2074225e22413536d0e2200b85b.tar.xz dnbd3-6d79f1645411f2074225e22413536d0e2200b85b.zip |
[SERVER] Minor fixes, add quick and dirty clang support to CMakeLists.txt
Use 'CC=/usr/local/bin/clang cmake -D_CMAKE_TOOLCHAIN_PREFIX=llvm- ..'
to compile using clang. Requires LLVM 3.1 since AddressSanitizer is
used for clang debug builds.
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/server/altservers.c | 3 | ||||
-rw-r--r-- | src/server/net.c | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 03964a6..96d7eda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,15 @@ ENDIF() message( "Build Type selected: ${CMAKE_BUILD_TYPE}" ) -SET(CMAKE_C_FLAGS_DEBUG "-std=c99 -O0 -g -Wall -Wno-unused-result -D_GNU_SOURCE -D_DEBUG -Wno-multichar") -SET(CMAKE_C_FLAGS_RELEASE "-std=c99 -O2 -Wno-unused-result -D_GNU_SOURCE -DNDEBUG -Wno-multichar") +if (CMAKE_C_COMPILER STREQUAL "gcc") + message( "gcc flags." ) + SET(CMAKE_C_FLAGS_DEBUG "-std=c99 -O0 -g -Wall -Wno-unused-result -D_GNU_SOURCE -D_DEBUG -Wno-multichar") + SET(CMAKE_C_FLAGS_RELEASE "-std=c99 -O2 -Wno-unused-result -D_GNU_SOURCE -DNDEBUG -Wno-multichar") +else() + message( "clang flags." ) + SET(CMAKE_C_FLAGS_DEBUG "-std=c99 -fsanitize=address -O1 -fno-omit-frame-pointer -g -Wall -Wno-unused-result -D_GNU_SOURCE -D_DEBUG -Wno-multichar") + SET(CMAKE_C_FLAGS_RELEASE "-std=c99 -O2 -Wno-unused-result -D_GNU_SOURCE -DNDEBUG -Wno-multichar") +endif() #SET(CMAKE_CXX_FLAGS_DEBUG "-std=c99 -O0 -g -Wall -Wno-unused-result -D_GNU_SOURCE -D_DEBUG") #SET(CMAKE_CXX_FLAGS_RELEASE "-std=c99 -O2 -Wno-unused-result -D_GNU_SOURCE -DNDEBUG" ) diff --git a/src/server/altservers.c b/src/server/altservers.c index 9a74ef2..a26ac2f 100644 --- a/src/server/altservers.c +++ b/src/server/altservers.c @@ -384,7 +384,8 @@ static void *altservers_main(void *data) // Wait 5 seconds max. numSocks = epoll_wait( fdEpoll, events, MAXEVENTS, 5000 ); if ( numSocks < 0 ) { - memlogf( "[WARNING] epoll_wait() error in uplink_connector" ); + const int err = errno; + memlogf( "[WARNING] epoll_wait() error %d in uplink_connector", err ); usleep( 100000 ); } if ( _shutdown ) goto cleanup; diff --git a/src/server/net.c b/src/server/net.c index 1d9d226..4ea95cf 100644 --- a/src/server/net.c +++ b/src/server/net.c @@ -368,8 +368,8 @@ void *net_client_handler(void *dnbd3_client) } exit_client_cleanup: ; if ( image_file != -1 ) close( image_file ); - client->running = FALSE; dnbd3_remove_client( client ); + client->running = FALSE; client = dnbd3_free_client( client ); return NULL ; } |