[parisc-linux-cvs] Fixes #74 - problems with ramdisk

Richard Hirst rhirst@linuxcare.com
Tue, 13 Mar 2001 22:44:37 +0000


On Tue, Mar 13, 2001 at 12:44:19PM -0700, Paul Bame wrote:
> 
> This was a parsing problem.  If 'initrd=' was the second argument
> in the command line the parser didn't see it.
> 
> Index: ipl/ipl.c
> ===================================================================
> RCS file: /home/cvs/parisc/palo/ipl/ipl.c,v
> retrieving revision 1.13
> diff -u -r1.13 ipl.c
> --- ipl.c	2001/02/09 04:06:22	1.13
> +++ ipl.c	2001/03/13 18:52:50
> @@ -93,7 +93,8 @@
>      strcpy(lcmd, suffix1);
>  
>      /* see if we have a ramdisk */
> -    if ((suffix2 = strstr(suffix1, " initrd=")) != NULL)
> +    if ((strncmp(suffix1, "initrd=", 7) == 0, suffix2 = suffix1) ||
> +	(suffix2 = strstr(suffix1, " initrd=")) != NULL)
>      {
>  	char *suffix3;
>  	lcmd[suffix2 - suffix1] = '\0';

Surely that is still broken.  suffix2 = suffix1 is always going to be
non-zero, so the 'if' will always succeed.

How about

	suffix2 = suffix1;
	if (strncmp(suffix1, "initrd=", 7) == 0 ||
		(suffix2 = strstr(suffix1, " initrd=")) != NULL)
	{


Richard