[ipxe-devel] [PATCH] fix up command-line support

Dave Hansen dave at sr71.net
Mon Jun 27 23:17:23 UTC 2011


I recently upgraded my version of iPXE and I noticed that the command-line
support was no longer working for me.  I'm not quite sure if I never
properly tested it, or what.

For me, this code just ends up NULL'ing out the first byte of the
command-line, effectively erasing it since strstr() returns the beginning
of the matched string:

	if ( ( tmp = strstr ( cmdline, "BOOT_IMAGE=" ) ) != NULL )
		*tmp = '\0';

I'm not quite sure what this code was trying to do, but I assume it was
trying to move 'cmdline' or 'tmp' past the "BOOT_IMAGE=" string.  I've
tried to do that by looking for the first space and calling _that_ the
beginning of the command-line.
---
 src/arch/i386/core/cmdline.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/arch/i386/core/cmdline.c b/src/arch/i386/core/cmdline.c
index fa5adb8..96548f8 100644
--- a/src/arch/i386/core/cmdline.c
+++ b/src/arch/i386/core/cmdline.c
@@ -93,7 +93,9 @@ static void cmdline_init ( void ) {
 		cmdline++;
 	if ( ( tmp = strstr ( cmdline, "BOOT_IMAGE=" ) ) != NULL ) {
 		DBGC ( image, "CMDLINE stripping \"%s\"\n", tmp );
-		*tmp = '\0';
+		tmp = strstr ( cmdline, " " );
+		if ( tmp != NULL )
+			cmdline = tmp + 1;
 	}
 	DBGC ( image, "CMDLINE using \"%s\"\n", cmdline );
 
-- 
1.6.6.rc0.50.gaf06e9

-- Dave




More information about the ipxe-devel mailing list