10024 loader: set command_errmsg to NULL after printing it out
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Reviewed by: Jason King <jason.king@joyent.com>
Approved by: Joshua M. Clulow <josh@sysmgr.org>
diff --git a/usr/src/boot/sys/boot/common/interp_forth.c b/usr/src/boot/sys/boot/common/interp_forth.c
index 6eb14a5..b3eebae 100644
--- a/usr/src/boot/sys/boot/common/interp_forth.c
+++ b/usr/src/boot/sys/boot/common/interp_forth.c
@@ -1,4 +1,4 @@
-/*-
+/*
  * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
  * All rights reserved.
  *
@@ -81,7 +81,7 @@
 
     /* Get the name of the current word */
     name = vm->runningWord->name;
-    
+
     /* Find our command structure */
     cmd = NULL;
     SET_FOREACH(cmdp, Xcommand_set) {
@@ -117,8 +117,9 @@
 	/* Get remainder of invocation */
 	tail = ficlVmGetInBuf(vm);
 
-	for (cp = tail, len = 0; cp != vm->tib.end && *cp != 0 && *cp != '\n'; cp++, len++)
-	    ;
+	len = 0;
+	for (cp = tail; cp != vm->tib.end && *cp != 0 && *cp != '\n'; cp++)
+		len++;
 
 	line = malloc(strlen(name) + len + 2);
 	strcpy(line, name);
@@ -136,12 +137,13 @@
 	result = (cmd)(argc, argv);
 	free(argv);
     } else {
-	result=BF_PARSE;
+	result = BF_PARSE;
     }
 
     switch (result) {
     case CMD_CRIT:
 	printf("%s\n", command_errmsg);
+	command_errmsg = NULL;
 	break;
     case CMD_FATAL:
 	panic("%s\n", command_errmsg);