[netfilter-cvslog] r3426 - trunk/nfsim/core

rusty at netfilter.org rusty at netfilter.org
Fri Dec 17 06:03:38 CET 2004


Author: rusty at netfilter.org
Date: 2004-12-17 06:03:37 +0100 (Fri, 17 Dec 2004)
New Revision: 3426

Modified:
   trunk/nfsim/core/failtest.c
Log:
Fix --failpattern for should_i_fail_once: assume false on second identical call.


Modified: trunk/nfsim/core/failtest.c
===================================================================
--- trunk/nfsim/core/failtest.c	2004-12-17 04:50:39 UTC (rev 3425)
+++ trunk/nfsim/core/failtest.c	2004-12-17 05:03:37 UTC (rev 3426)
@@ -32,7 +32,7 @@
 /* Failures pattern so far. */
 static char *faillist;
 /* Failure pattern to follow (initialized by --failpattern). */
-static const char *failpattern = NULL;
+static const char *failpattern = NULL, *orig_failpattern;
 
 /*** XML Argument:
     <section id="a:failtest">
@@ -99,16 +99,20 @@
 {
 	char *p;
 
-	if (failpattern)
+	if (failpattern) {
+		p = strstr(orig_failpattern ?: "", location);
+		if (p && p <= failpattern
+		    && p[-1] == '[' && p[strlen(location)] == ']')
+			return false;
+
 		return do_failpattern(location);
+	}
 
-	if (!failtest || suppress_failtest)
-		return false;
-
 	p = strstr(faillist ?: "", location);
 	if (p && p[-1] == '[' && p[strlen(location)] == ']')
 		return false;
 
+
 	return should_i_fail(location);
 }
 
@@ -157,5 +161,5 @@
 void set_failtest(bool ft, const char *initial_failpattern)
 {
 	failtest = ft;
-	failpattern = initial_failpattern;
+	orig_failpattern = failpattern = initial_failpattern;
 }




More information about the netfilter-cvslog mailing list