Skip to content

Commit

Permalink
Fixed uncompression return value checks in tools
Browse files Browse the repository at this point in the history
  • Loading branch information
jgehring committed Apr 2, 2012
1 parent 6f64839 commit ec2b3ca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 1 addition & 5 deletions scmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,7 @@ int main(int ac, char **av)
char *out;
size_t outlen;
if (mode == uncompress) {
if (!snappy_uncompressed_length(map, size, &outlen)) {
fprintf(stderr, "Cannot read length in %s\n",
av[optind]);
exit(1);
}
err = snappy_uncompressed_length(map, size, &outlen);
} else {
outlen = snappy_max_compressed_length(size);
}
Expand Down
5 changes: 3 additions & 2 deletions sgverify.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ int main(int ac, char **av)

char *obuf = malloc(st_size);

if (!snappy_uncompress_iov(out_iov, ov, outlen, obuf))
printf("uncompression of %s failed\n", *av);
err = snappy_uncompress_iov(out_iov, ov, outlen, obuf);
if (err < 0)
printf("uncompression of %s failed: %d\n", *av, err);

if (memcmp(obuf, map, st_size)) {
printf("comparison of %s failed, olen %lu, orig %lu, rnd_seq %d\n", *av,
Expand Down

0 comments on commit ec2b3ca

Please sign in to comment.