diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2011-12-13 22:25:59 -0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2011-12-13 22:29:37 -0800 |
commit | 850a198ff1879e506c961c91da30009539ed14b3 (patch) | |
tree | 14e4847af5c6536a1f662a9f6562ccfa13486709 /gzwrite.c | |
parent | 377173b57ef9fab5066481a87a1901bd72fa2c32 (diff) | |
download | zlib-850a198ff1879e506c961c91da30009539ed14b3.tar.gz zlib-850a198ff1879e506c961c91da30009539ed14b3.tar.bz2 zlib-850a198ff1879e506c961c91da30009539ed14b3.zip |
Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF.
Z_BUF_ERROR was also being used for an unsuccessful gzungetc and for buffer
lengths that didn't fit in an int. Those uses were changed to Z_DATA_ERROR
in order to assure that Z_BUF_ERROR occurs only when a premature end of
input occurs, indicating that gzclearerr() can be used.
Diffstat (limited to 'gzwrite.c')
-rw-r--r-- | gzwrite.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -185,7 +185,7 @@ int ZEXPORT gzwrite(file, buf, len) | |||
185 | /* since an int is returned, make sure len fits in one, otherwise return | 185 | /* since an int is returned, make sure len fits in one, otherwise return |
186 | with an error (this avoids the flaw in the interface) */ | 186 | with an error (this avoids the flaw in the interface) */ |
187 | if ((int)len < 0) { | 187 | if ((int)len < 0) { |
188 | gz_error(state, Z_BUF_ERROR, "requested length does not fit in int"); | 188 | gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); |
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
191 | 191 | ||