aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stand/common/interp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/stand/common/interp.c b/stand/common/interp.c
index 8941101f6479..a0a6bd486614 100644
--- a/stand/common/interp.c
+++ b/stand/common/interp.c
@@ -45,8 +45,17 @@ __FBSDID("$FreeBSD$");
void
interact(void)
{
- static char input[256]; /* big enough? */
+ static char input[256]; /* big enough? */
+ const char * volatile interp_identifier;
+ /*
+ * Because interp_identifier is volatile, it cannot be optimized out by
+ * the compiler as it's considered an externally observable event. This
+ * prevents the compiler from optimizing out our carefully placed
+ * $Interpreter:4th string that userboot may use to determine that
+ * we need to switch interpreters.
+ */
+ interp_identifier = bootprog_interp;
interp_init();
printf("\n");