summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am8
-rw-r--r--src/ulogd.c17
2 files changed, 16 insertions, 9 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 998e776..7a12a72 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,8 +1,8 @@
+include $(top_srcdir)/Make_global.am
-AM_CPPFLAGS = -I$(top_srcdir)/include \
- -DULOGD_CONFIGFILE="\"$(sysconfdir)/ulogd.conf\"" \
- -DULOGD_LOGFILE_DEFAULT="\"$(localstatedir)/log/ulogd.log\""
-AM_CFLAGS = ${regular_CFLAGS}
+AM_CPPFLAGS += -DULOGD_CONFIGFILE='"$(sysconfdir)/ulogd.conf"' \
+ -DULOGD_LOGFILE_DEFAULT='"$(localstatedir)/log/ulogd.log"' \
+ -DULOGD2_LIBDIR='"$(ulogd2libdir)"'
sbin_PROGRAMS = ulogd
diff --git a/src/ulogd.c b/src/ulogd.c
index 9cd64e8..6c5ff9a 100644
--- a/src/ulogd.c
+++ b/src/ulogd.c
@@ -661,12 +661,11 @@ pluginstance_alloc_init(struct ulogd_plugin *pl, char *pi_id,
}
size += pl->input.num_keys * sizeof(struct ulogd_key);
size += pl->output.num_keys * sizeof(struct ulogd_key);
- pi = malloc(size);
+ pi = calloc(1, size);
if (!pi)
return NULL;
/* initialize */
- memset(pi, 0, size);
INIT_LLIST_HEAD(&pi->list);
INIT_LLIST_HEAD(&pi->plist);
pi->plugin = pl;
@@ -965,7 +964,6 @@ static int create_stack(const char *option)
load_all_plugins();
if (!buf) {
- ulogd_log(ULOGD_ERROR, "");
ret = -ENOMEM;
goto out_buf;
}
@@ -1136,7 +1134,7 @@ static int parse_conffile(const char *section, struct config_keyset *ce)
"section \"%s\" not found\n", section);
break;
case -ERRTOOLONG:
- if (config_errce->key)
+ if (config_errce)
ulogd_log(ULOGD_ERROR,
"string value too long for key \"%s\"\n",
config_errce->key);
@@ -1336,6 +1334,15 @@ static void stop_pluginstances()
(*pi->plugin->stop)(pi);
pi->private[0] = 0;
}
+
+ /* NB: plugin->stop() might access other plugin instances,
+ * so we cannot free right away.
+ */
+ }
+ }
+
+ llist_for_each_entry(stack, &ulogd_pi_stacks, stack_list) {
+ llist_for_each_entry_safe(pi, npi, &stack->list, list) {
free(pi);
}
}
@@ -1570,7 +1577,7 @@ int main(int argc, char* argv[])
if (daemonize){
if (daemon(0, 0) < 0) {
ulogd_log(ULOGD_FATAL, "can't daemonize: %s (%d)\n",
- errno, strerror(errno));
+ strerror(errno), errno);
warn_and_exit(daemonize);
}
}