Tidy inflateEnd calls

So that no one need worry about the value of Z_OK.

bfd/
	* compress.c (decompress_contents): Tidy inflateEnd result test.
binutils/
	* readelf.c (uncompress_section_contents): Tidy inflateEnd result test.
This commit is contained in:
Alan Modra 2021-01-16 09:45:09 +10:30
parent eb6e6af8c1
commit ad92f33d38
4 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,7 @@
2021-01-16 Alan Modra <amodra@gmail.com>
* compress.c (decompress_contents): Tidy inflateEnd result test.
2021-01-16 Alan Modra <amodra@gmail.com>
PR 26002

View file

@ -60,8 +60,7 @@ decompress_contents (bfd_byte *compressed_buffer,
break;
rc = inflateReset (&strm);
}
rc |= inflateEnd (&strm);
return rc == Z_OK && strm.avail_out == 0;
return inflateEnd (&strm) == Z_OK && rc == Z_OK && strm.avail_out == 0;
}
/* Compress data of the size specified in @var{uncompressed_size}

View file

@ -1,3 +1,7 @@
2021-01-16 Alan Modra <amodra@gmail.com>
* readelf.c (uncompress_section_contents): Tidy inflateEnd result test.
2021-01-15 Alan Modra <amodra@gmail.com>
PR 26539

View file

@ -14229,8 +14229,8 @@ uncompress_section_contents (unsigned char ** buffer,
break;
rc = inflateReset (& strm);
}
rc |= inflateEnd (& strm);
if (rc != Z_OK
if (inflateEnd (& strm) != Z_OK
|| rc != Z_OK
|| strm.avail_out != 0)
goto fail;