diff options
author | David Bremner <david@tethera.net> | 2020-04-12 20:00:31 -0300 |
---|---|---|
committer | David Bremner <david@tethera.net> | 2020-04-13 17:13:55 -0300 |
commit | 2c1f783f5f4ad28d89f2e83d7253bae7bba98440 (patch) | |
tree | 625c4cec17dbfe044c0bc78c8c96adf6221d63bb /util | |
parent | d50f41c0fd0bbd2ca2b364f49deaea8be63dff3c (diff) |
don't pass NULL as second parameter to gzerror
Although (as of 1.2.11) zlib checks this parameter before writing to
it, the docs don't promise to keep doing so, so be safe.
Diffstat (limited to 'util')
-rw-r--r-- | util/zlib-extra.c | 2 | ||||
-rw-r--r-- | util/zlib-extra.h | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/util/zlib-extra.c b/util/zlib-extra.c index f691cccf..623f6d62 100644 --- a/util/zlib-extra.c +++ b/util/zlib-extra.c @@ -80,7 +80,7 @@ const char * gz_error_string (util_status_t status, gzFile file) { if (status == UTIL_GZERROR) - return gzerror (file, NULL); + return gzerror_str (file); else return util_error_string (status); } diff --git a/util/zlib-extra.h b/util/zlib-extra.h index 209fa998..296dc914 100644 --- a/util/zlib-extra.h +++ b/util/zlib-extra.h @@ -27,6 +27,11 @@ gz_getline (void *ctx, char **lineptr, ssize_t *bytes_read, gzFile stream); const char * gz_error_string (util_status_t status, gzFile stream); +/* Call gzerror with a dummy errno argument, the docs don't promise to + * support the NULL case */ +inline const char * +gzerror_str(gzFile file) { int dummy; return gzerror (file, &dummy); } + #ifdef __cplusplus } #endif |