Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Mar 2013 21:08:25 GMT
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 222934 for review
Message-ID:  <201303162108.r2GL8PvK059873@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@222934?ac=10

Change 222934 by pjd@pjd_anger on 2013/03/16 21:08:12

	Merge from FreeBSD-HEAD:
	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.

Affected files ...

.. //depot/projects/trustedbsd/openbsm/bin/auditdistd/sender.c#4 edit

Differences ...

==== //depot/projects/trustedbsd/openbsm/bin/auditdistd/sender.c#4 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/trustedbsd/openbsm/bin/auditdistd/sender.c#3 $
+ * $P4: //depot/projects/trustedbsd/openbsm/bin/auditdistd/sender.c#4 $
  */
 
 #include <config/config.h>
@@ -394,6 +394,7 @@
 
 	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 @@
 	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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303162108.r2GL8PvK059873>