[netfilter-cvslog] r3463 - in trunk/nfsim: core tools

rusty at netfilter.org rusty at netfilter.org
Mon Dec 20 04:41:08 CET 2004


Author: rusty at netfilter.org
Date: 2004-12-20 04:41:07 +0100 (Mon, 20 Dec 2004)
New Revision: 3463

Modified:
   trunk/nfsim/core/core.c
   trunk/nfsim/core/core.h
   trunk/nfsim/core/failtest.c
   trunk/nfsim/tools/iptables.c
Log:
Move suppress_failtest to core.h.
Suppress failtesting during initialization (waste of cycles).
Check stdin is not a tty after all options parsed: makes --failtest <file> work.


Modified: trunk/nfsim/core/core.c
===================================================================
--- trunk/nfsim/core/core.c	2004-12-20 02:49:09 UTC (rev 3462)
+++ trunk/nfsim/core/core.c	2004-12-20 03:41:07 UTC (rev 3463)
@@ -383,6 +383,8 @@
 		talloc_free(path);
 	}
 
+	/* Don't do failures during initialization. */
+	suppress_failtest = true;
 	kernelenv_init();
 
 	run_inits();
@@ -399,6 +401,7 @@
 	nfsim_log(LOG_UI, "initialisation done");
 
 	message_init();
+	suppress_failtest = false;
 
 	tui_run(!get_failtest(), STDIN_FILENO);
 

Modified: trunk/nfsim/core/core.h
===================================================================
--- trunk/nfsim/core/core.h	2004-12-20 02:49:09 UTC (rev 3462)
+++ trunk/nfsim/core/core.h	2004-12-20 03:41:07 UTC (rev 3463)
@@ -265,6 +265,7 @@
 bool should_i_fail(const char *func);
 bool should_i_fail_once(const char *location);
 bool get_failtest(void);
+extern bool suppress_failtest;
 
 enum exitcodes
 {

Modified: trunk/nfsim/core/failtest.c
===================================================================
--- trunk/nfsim/core/failtest.c	2004-12-20 02:49:09 UTC (rev 3462)
+++ trunk/nfsim/core/failtest.c	2004-12-20 03:41:07 UTC (rev 3463)
@@ -52,8 +52,6 @@
 */
 static void cmdline_failtest(struct option *opt)
 {
-	if (isatty(STDIN_FILENO))
-		barf("Not clever enough to use --failtest interactively");
 	failtest = true;
 }
 cmdline_opt("failtest", 0, 0, cmdline_failtest);
@@ -183,3 +181,11 @@
 	exit(EXIT_SILENT);
 }
 
+/* Need to wait until after parsing to test stdin. */
+static void test_failtest_file(void)
+{
+	if (failtest && isatty(STDIN_FILENO))
+		barf("Not clever enough to use --failtest interactively");
+}
+
+init_call(test_failtest_file);

Modified: trunk/nfsim/tools/iptables.c
===================================================================
--- trunk/nfsim/tools/iptables.c	2004-12-20 02:49:09 UTC (rev 3462)
+++ trunk/nfsim/tools/iptables.c	2004-12-20 03:41:07 UTC (rev 3463)
@@ -36,8 +36,6 @@
  * of fork in failtest.c, do a new run_command() and replay the
  * messages, which effectively "forks" the external program.
  */
-extern bool suppress_failtest;
-
 static bool run_command(int argc, char **argv)
 {
 	pid_t child;




More information about the netfilter-cvslog mailing list