summaryrefslogtreecommitdiffstats
path: root/util/cbfstool/cbfscomptool.c
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@chromium.org>2017-01-23 09:35:44 +0100
committerPatrick Georgi <pgeorgi@google.com>2017-01-24 09:35:49 +0100
commitb46c4ecaba97cc1edbfa2114651fc2bcbf49914b (patch)
tree818572c9cd07f36c0ad621e2e6b52c8c9bdffb16 /util/cbfstool/cbfscomptool.c
parente80c6f6d3cd0eb7bde651364cc29d41da94f0082 (diff)
downloadcoreboot-b46c4ecaba97cc1edbfa2114651fc2bcbf49914b.tar.gz
coreboot-b46c4ecaba97cc1edbfa2114651fc2bcbf49914b.tar.bz2
coreboot-b46c4ecaba97cc1edbfa2114651fc2bcbf49914b.zip
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>
Diffstat (limited to 'util/cbfstool/cbfscomptool.c')
-rw-r--r--util/cbfstool/cbfscomptool.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/util/cbfstool/cbfscomptool.c b/util/cbfstool/cbfscomptool.c
index 1aa16995886c..9e804860a9af 100644
--- a/util/cbfstool/cbfscomptool.c
+++ b/util/cbfstool/cbfscomptool.c
@@ -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;