summaryrefslogtreecommitdiff
path: root/contrib/openbsm
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2013-02-28 01:24:24 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2013-02-28 01:24:24 +0000
commita66ffea41d7ea4e39a49bc146e6f6decb4fbd02c (patch)
treec1ce6ca680f3be4df581589e5a256548650805ff /contrib/openbsm
parenteff269ee18dc7dc7b465730e5d76830fe93b4256 (diff)
downloadsrc-test-a66ffea41d7ea4e39a49bc146e6f6decb4fbd02c.tar.gz
src-test-a66ffea41d7ea4e39a49bc146e6f6decb4fbd02c.zip
When we are waiting for new trail files we may have been disconnected and
reconnected in the meantime. Check if reset is set before opening next trail file, as not doing so will result in sending OPEN message with the same file name twice and this is illegal - the second OPEN is send without first closing previous trail file.
Notes
Notes: svn path=/head/; revision=247442
Diffstat (limited to 'contrib/openbsm')
-rw-r--r--contrib/openbsm/bin/auditdistd/sender.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/contrib/openbsm/bin/auditdistd/sender.c b/contrib/openbsm/bin/auditdistd/sender.c
index 256fbb1f4759f..ab90e6ce03d1a 100644
--- a/contrib/openbsm/bin/auditdistd/sender.c
+++ b/contrib/openbsm/bin/auditdistd/sender.c
@@ -394,6 +394,7 @@ read_thread_wait(void)
mtx_lock(&adist_remote_mtx);
if (adhost->adh_reset) {
+reset:
adhost->adh_reset = false;
if (trail_filefd(adist_trail) != -1)
trail_close(adist_trail);
@@ -408,6 +409,14 @@ read_thread_wait(void)
while (trail_filefd(adist_trail) == -1) {
newfile = true;
wait_for_dir();
+ /*
+ * We may have been disconnected and reconnected in the
+ * meantime, check if reset is set.
+ */
+ mtx_lock(&adist_remote_mtx);
+ if (adhost->adh_reset)
+ goto reset;
+ mtx_unlock(&adist_remote_mtx);
if (trail_filefd(adist_trail) == -1)
trail_next(adist_trail);
}