PERFORCE change 222934 for review

Pawel Jakub Dawidek pjd at FreeBSD.org
Sat Mar 16 21:08:27 UTC 2013


http://p4web.freebsd.org/@@222934?ac=10

Change 222934 by pjd at 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);
 	}


More information about the p4-projects mailing list