Skip to content

Commit

Permalink
Use sysconfdir for default nfdump.conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
phaag committed Aug 31, 2024
1 parent 99db1cd commit 14b2179
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libnffile/Makefile.am
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
7 changes: 4 additions & 3 deletions src/libnffile/conf/nfconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <arpa/nameser.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <netdb.h>
#include <netinet/in.h>
#include <resolv.h>
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 14b2179

Please sign in to comment.