projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
powerpc: mpc85xx: remove P1_P2_RDB boards
[oweals/u-boot.git]
/
lib
/
gunzip.c
diff --git
a/lib/gunzip.c
b/lib/gunzip.c
index 9959781b0004096fe542d950f0cea3f98f066fd3..f469fcbeadb5c0ceb77bc2e3b7a78a15797ffe6a 100644
(file)
--- a/
lib/gunzip.c
+++ b/
lib/gunzip.c
@@
-73,6
+73,7
@@
int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
int stoponerr, int offset)
{
z_stream s;
int stoponerr, int offset)
{
z_stream s;
+ int err = 0;
int r;
s.zalloc = gzalloc;
int r;
s.zalloc = gzalloc;
@@
-89,16
+90,16
@@
int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
s.avail_out = dstlen;
do {
r = inflate(&s, Z_FINISH);
s.avail_out = dstlen;
do {
r = inflate(&s, Z_FINISH);
- if (r != Z_STREAM_END && r != Z_BUF_ERROR && stoponerr == 1) {
+ if (stoponerr == 1 && r != Z_STREAM_END &&
+ (s.avail_out == 0 || r != Z_BUF_ERROR)) {
printf("Error: inflate() returned %d\n", r);
printf("Error: inflate() returned %d\n", r);
-
inflateEnd(&s)
;
-
return -1
;
+
err = -1
;
+
break
;
}
s.avail_in = *lenp - offset - (int)(s.next_out - (unsigned char*)dst);
}
s.avail_in = *lenp - offset - (int)(s.next_out - (unsigned char*)dst);
- s.avail_out = dstlen;
} while (r == Z_BUF_ERROR);
*lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s);
} while (r == Z_BUF_ERROR);
*lenp = s.next_out - (unsigned char *) dst;
inflateEnd(&s);
- return
0
;
+ return
err
;
}
}