[flashrom] [PATCH] Fix and clean up cli_classic.c

Stefan Tauner stefan.tauner at student.tuwien.ac.at
Mon Jul 18 14:13:27 CEST 2011


On Sat, 16 Jul 2011 01:06:40 +0200
Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net> wrote:

> +			if (find_romentry(tempstr)) {
> +				fprintf(stderr, "Error: image %s not found in "
> +					"layout file or -i specified before "
> +					"-l\n", tempstr);
> +				cli_classic_abort_usage();
> +			}

find_romentry does return the index of the (first matching) rom entry
(>=0) on success, or -1 on failure:

int find_romentry(char *name)
{
	int i;

	if (!romimages)
		return -1;

	msg_ginfo("Looking for \"%s\"... ", name);

	for (i = 0; i < romimages; i++) {
		if (!strcmp(rom_entries[i].name, name)) {
			rom_entries[i].included = 1;
			msg_ginfo("found.\n");
			return i;
		}
	}
	msg_ginfo("not found.\n");	// Not found. Error.

	return -1;
}

the attached patch fixes this. thanks to Florian Zumbiehl for reporting
this (http://paste.flashrom.org/view.php?id=707).

carldani: you wrote you did not fix the -l/-i ordering problem "because
the new layout code may have different requirements anyway".
the first step to fix this is to extract the needed file and region
names from the command line (to use them after the parsing loop has
finished). this is somewhat independent from whatever we do with the
arguments then. if you agree i would like to fix this now (i did not
look for what is needed exactly yet), if not you can just ack the patch.

-- 
Kind regards/Mit freundlichen Grüßen, Stefan Tauner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-fix-a-bug-breaking-layout-file-handling-in-r1373.patch
Type: text/x-patch
Size: 852 bytes
Desc: not available
URL: <http://www.flashrom.org/pipermail/flashrom/attachments/20110718/03664d0c/attachment.patch>


More information about the flashrom mailing list