diff options
-rw-r--r-- | Makefile.am | 4 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | libebtc.c | 7 |
3 files changed, 6 insertions, 8 deletions
diff --git a/Makefile.am b/Makefile.am index 59ae595..53fcbad 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,8 +5,6 @@ PROGNAME = ${PACKAGE_NAME} PROGVERSION = ${PACKAGE_VERSION} PROGDATE = December\ 2011 -LOCKDIR = /var/lib/ebtables -LOCKFILE = ${LOCKDIR}/lock INITDIR = /etc/rc.d/init.d initddir = ${INITDIR} sysconfigdir = ${sysconfdir}/sysconfig @@ -21,7 +19,7 @@ AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_srcdir}/include \ -DPROGVERSION=\"${PACKAGE_VERSION}\" -DPROGNAME=\"${PACKAGE_NAME}\" \ -DPROGDATE=\"${PROGDATE}\" \ -D_PATH_ETHERTYPES=\"${sysconfdir}/ethertypes\" \ - -DLOCKFILE=\"${LOCKFILE}\" -DLOCKDIR=\"${LOCKDIR}\" \ + -DLOCKFILE=\"${LOCKFILE}\" \ -DEBTD_ARGC_MAX=${EBTD_ARGC_MAX} -DEBTD_CMDLINE_MAXLN=${EBTD_CMDLINE_MAXLN} \ -DEBTD_PIPE=\"${PIPE}\" -DEBTD_PIPE_DIR=\"${PIPE_DIR}\" AM_CFLAGS = ${regular_CFLAGS} diff --git a/configure.ac b/configure.ac index a3bc3c9..00d9773 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,9 @@ AC_DISABLE_STATIC m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) AM_PROG_LIBTOOL +AC_ARG_VAR([LOCKFILE], [Custom libebtc lockfile path (default: /var/lib/ebtables/lock)]) +AS_IF([test "x$LOCKFILE" = x], [LOCKFILE="/var/lib/ebtables/lock"]) + regular_CFLAGS="-Wall -Wunused" regular_CPPFLAGS="" case "$host" in @@ -36,6 +36,7 @@ #include <sys/stat.h> #include <sys/types.h> #include <errno.h> +#include <libgen.h> static void decrease_chain_jumps(struct ebt_u_replace *replace); static int iterate_entries(struct ebt_u_replace *replace, int type); @@ -134,10 +135,6 @@ void ebt_list_extensions() } } -#ifndef LOCKFILE -#define LOCKDIR "/var/lib/ebtables" -#define LOCKFILE LOCKDIR"/lock" -#endif int use_lockfd; /* Returns 0 on success, -1 when the file is locked by another process * or -2 on any other error. */ @@ -148,7 +145,7 @@ static int lock_file() retry: fd = open(LOCKFILE, O_CREAT, 00600); if (fd < 0) { - if (try == 1 || mkdir(LOCKDIR, 00700)) + if (try == 1 || mkdir(dirname(LOCKFILE), 00700)) return -2; try = 1; goto retry; |