cbfs-compression-tool: catch compression failures

If compression failed, just store the uncompressed data, which is what
cbfstool does as well.

Change-Id: I67f51982b332d6ec1bea7c9ba179024fc5344743
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: https://review.coreboot.org/18201
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Patrick Georgi 2017-01-23 09:35:44 +01:00 committed by Patrick Georgi
parent e80c6f6d3c
commit b46c4ecaba
1 changed files with 6 additions and 1 deletions

View File

@ -150,7 +150,12 @@ int compress(char *infile, char *outfile, char *algoname)
remsize -= readsz;
}
comp(indata, insize, outdata, &outsize);
if (comp(indata, insize, outdata, &outsize) == -1) {
outsize = insize;
free(outdata);
outdata = indata;
algo = &types_cbfs_compression[0];
}
char header[8];
header[0] = algo->type & 0xff;