[coreboot-gerrit] Change in coreboot[master]: cbfs-compression-tool: Minor edge case handling fixes

Julius Werner (Code Review) gerrit at coreboot.org
Sat May 19 03:05:08 CEST 2018


Julius Werner has uploaded this change for review. ( https://review.coreboot.org/26389


Change subject: cbfs-compression-tool: Minor edge case handling fixes
......................................................................

cbfs-compression-tool: Minor edge case handling fixes

This patch makes cbfs-compression-tool fail and exit if it cannot parse
the supplied compression algorithm, rather than just falling back to
"none". It also changes the algorithm detection to strcasecmp() so that
you can use either "LZ4" or "lz4" (or "lZ4" or whatever).

Change-Id: I375dbaeefaa0d4b0c5be81bf7668f8f330f1cf61
Signed-off-by: Julius Werner <jwerner at chromium.org>
---
M util/cbfstool/cbfscomptool.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/26389/1

diff --git a/util/cbfstool/cbfscomptool.c b/util/cbfstool/cbfscomptool.c
index 1021bc8..33303ab 100644
--- a/util/cbfstool/cbfscomptool.c
+++ b/util/cbfstool/cbfscomptool.c
@@ -97,11 +97,12 @@
 
 	const struct typedesc_t *algo = &types_cbfs_compression[0];
 	while (algo->name != NULL) {
-		if (strcmp(algo->name, algoname) == 0) break;
+		if (strcasecmp(algo->name, algoname) == 0) break;
 		algo++;
 	}
 	if (algo->name == NULL) {
 		fprintf(stderr, "algo '%s' is not supported.\n", algoname);
+		return 1;
 	}
 
 	comp_func_ptr comp = compression_function(algo->type);

-- 
To view, visit https://review.coreboot.org/26389
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I375dbaeefaa0d4b0c5be81bf7668f8f330f1cf61
Gerrit-Change-Number: 26389
Gerrit-PatchSet: 1
Gerrit-Owner: Julius Werner <jwerner at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180519/bde77a82/attachment.html>


More information about the coreboot-gerrit mailing list