https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ad92f33d386e050304bf5986f28071ede9dd2284
commit ad92f33d386e050304bf5986f28071ede9dd2284
Author: Alan Modra <amodra@gmail.com>
Date: Sat Jan 16 09:45:09 2021 +1030
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.
Diff:
---
bfd/ChangeLog | 4 ++++
bfd/compress.c | 3 +--
binutils/ChangeLog | 4 ++++
binutils/readelf.c | 4 ++--
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d3282a3defb..40534b8f7f1 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/compress.c b/bfd/compress.c
index 4cd9b2e6735..2e73c760e75 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -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}
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0e3ae10c8ac..efb86d2d5f6 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/readelf.c b/binutils/readelf.c
index d828d5636df..5df51086226 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -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;