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

rusty at netfilter.org rusty at netfilter.org
Thu Dec 16 02:34:50 CET 2004


Author: rusty at netfilter.org
Date: 2004-12-16 02:34:50 +0100 (Thu, 16 Dec 2004)
New Revision: 3400

Modified:
   trunk/nfsim/core/core.h
   trunk/nfsim/core/failtest.c
Log:
Actually check in should_i_fail_once.


Modified: trunk/nfsim/core/core.h
===================================================================
--- trunk/nfsim/core/core.h	2004-12-16 01:11:02 UTC (rev 3399)
+++ trunk/nfsim/core/core.h	2004-12-16 01:34:50 UTC (rev 3400)
@@ -262,6 +262,7 @@
 
 /* For failtest to test malloc etc failures. */
 bool should_i_fail(const char *func);
+bool should_i_fail_once(const char *location);
 void set_failtest(bool failtest, const char *initial_failpattern);
 
 enum exitcodes

Modified: trunk/nfsim/core/failtest.c
===================================================================
--- trunk/nfsim/core/failtest.c	2004-12-16 01:11:02 UTC (rev 3399)
+++ trunk/nfsim/core/failtest.c	2004-12-16 01:34:50 UTC (rev 3400)
@@ -86,6 +86,25 @@
 	}
 }
 
+/* Should I fail at this point?  Once only: it would be too expensive
+ * to fail at every possible call. */
+bool should_i_fail_once(const char *location)
+{
+	char *p;
+
+	if (failpattern)
+		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);
+}
+
 /* Should I fail at this point? */
 bool should_i_fail(const char *func)
 {




More information about the netfilter-cvslog mailing list