return nl_wait_for_ack(sk);
}
+static inline int build_sysconf_path(char **strp, const char *filename)
+{
+ char *sysconfdir;
+
+ sysconfdir = getenv("NLSYSCONFDIR");
+
+ if (!sysconfdir)
+ sysconfdir = SYSCONFDIR;
+
+ return asprintf(strp, "%s/%s", sysconfdir, filename);
+}
+
#endif
FILE *fd;
int err;
- asprintf(&path, "%s/classid", SYSCONFDIR);
+ if (build_sysconf_path(&path, "classid") < 0)
+ return -NLE_NOMEM;
/* if stat fails, just (re-)read the file */
if (stat(path, &st) == 0) {
NL_DBG(2, "Generated new classid %#x\n", classid);
- if (asprintf(&path, "%s/classid", SYSCONFDIR) < 0)
+ if (build_sysconf_path(&path, "classid") < 0)
return -NLE_NOMEM;
if (!(fd = fopen(path, "a"))) {
int i, err;
FILE *fd;
- asprintf(&path, "%s/pktloc", SYSCONFDIR);
+ if (build_sysconf_path(&path, "pktloc") < 0)
+ return -NLE_NOMEM;
/* if stat fails, just try to read the file */
if (stat(path, &st) == 0) {
SUBDIRS = lib
-AM_CPPFLAGS = -Wall -I${top_srcdir}/include -I${top_builddir}/include -D_GNU_SOURCE
+AM_CPPFLAGS = -Wall -I${top_srcdir}/include -I${top_builddir}/include -D_GNU_SOURCE -DSYSCONFDIR=\"$(sysconfdir)/libnl\"
AM_LDFLAGS = -L${top_builddir}/lib -L${top_builddir}/src/lib -lnl-cli -lnl -lnl-nf -lnl-genl -lnl-route
sbin_PROGRAMS = \