From 14b2179d7c742cc854fddb208935db082a63009d Mon Sep 17 00:00:00 2001 From: Peter Haag Date: Sat, 31 Aug 2024 16:19:51 +0200 Subject: [PATCH] Use sysconfdir for default nfdump.conf file --- src/libnffile/Makefile.am | 2 +- src/libnffile/conf/nfconf.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libnffile/Makefile.am b/src/libnffile/Makefile.am index c0ed605f..2fd1cdb9 100755 --- a/src/libnffile/Makefile.am +++ b/src/libnffile/Makefile.am @@ -1,6 +1,6 @@ BUILT_SOURCES = vcs_track.h -AM_CPPFLAGS = -I.. -I../include -I../inline -Iconf -Icompress $(DEPS_CFLAGS) +AM_CPPFLAGS = -I.. -I../include -I../inline -Iconf -Icompress $(DEPS_CFLAGS) -DSYSCONFDIR='"$(sysconfdir)"' AM_CFLAGS = -ggdb LDADD = $(DEPS_LIBS) diff --git a/src/libnffile/conf/nfconf.c b/src/libnffile/conf/nfconf.c index 61445cca..6c6239df 100644 --- a/src/libnffile/conf/nfconf.c +++ b/src/libnffile/conf/nfconf.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -51,7 +52,7 @@ #include "toml.h" #include "util.h" -#define NFCONF_FILE "/usr/local/etc/nfdump.conf" +#define NFCONF_FILE SYSCONFDIR "/nfdump.conf" typedef struct nfconfFile_s { int valid; // flag @@ -308,7 +309,7 @@ static void ConfPrintTableValue(toml_table_t *sectionConf, const char *tableName } val = toml_table_int(sectionConf, entry); if (val.ok) { - printf("%s:%-10s int : %lld\n", tableName, entry, val.u.i); + printf("%s:%-10s int : %" PRIi64 "\n", tableName, entry, val.u.i); } val = toml_table_double(sectionConf, entry); if (val.ok) { @@ -333,7 +334,7 @@ static void ConfPrintArrayValue(toml_array_t *sectionConf, const char *arrayName } val = toml_array_int(sectionConf, entry); if (val.ok) { - printf("%s:[%d] int : %lld\n", arrayName, entry, val.u.i); + printf("%s:[%d] int : %" PRIi64 "\n", arrayName, entry, val.u.i); } val = toml_array_double(sectionConf, entry); if (val.ok) {