summaryrefslogtreecommitdiff
path: root/util/cbfstool/cbfscomptool.c
diff options
context:
space:
mode:
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 1aa1699588..9e804860a9 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;