commit eb2316381c28b0c0026cca53f26cac378a0bfdc0
parent a294bd207b569f011674e66ebbd5298511f7ee47
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Thu, 12 Nov 2015 20:55:28 +0100
Define GeoIP databases path in CMakeLists.txt
Diffstat:
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -4,7 +4,7 @@
# https://github.com/fcambus/logswan #
# #
# Created: 2015/05/31 #
-# Last Updated: 2015/11/02 #
+# Last Updated: 2015/11/12 #
# #
###############################################################################
@@ -28,6 +28,7 @@ if(NOT HAVE_STRTONUM)
endif()
add_definitions(-Wall -Wextra -Werror -std=c99 -pedantic)
+add_definitions(-DDBPATH="/usr/local/share/GeoIP/")
add_executable(logswan ${SRC} ${DEPS})
target_link_libraries(logswan ${LIB_GEOIP} ${LIB_JANSSON} m)
diff --git a/src/logswan.c b/src/logswan.c
@@ -4,7 +4,7 @@
/* https://github.com/fcambus/logswan */
/* */
/* Created: 2015/05/31 */
-/* Last Updated: 2015/11/02 */
+/* Last Updated: 2015/11/12 */
/* */
/* Logswan is released under the BSD 3-Clause license. */
/* See LICENSE file for details. */
@@ -102,8 +102,8 @@ int main (int argc, char *argv[]) {
begin = clock();
/* Initializing GeoIP */
- geoip = GeoIP_open("/usr/local/share/GeoIP/GeoIP.dat", GEOIP_MEMORY_CACHE);
- geoipv6 = GeoIP_open("/usr/local/share/GeoIP/GeoIPv6.dat", GEOIP_MEMORY_CACHE);
+ geoip = GeoIP_open(DBPATH "/GeoIP.dat", GEOIP_MEMORY_CACHE);
+ geoipv6 = GeoIP_open(DBPATH "/GeoIPv6.dat", GEOIP_MEMORY_CACHE);
/* Get log file size */
stat(intputFile, &logFileSize);