summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2017-08-03 14:48:54 -0400
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2017-08-03 14:55:17 -0400
commit12f1e523ad15480e60e8cc20fe5f768b360001d8 (patch)
tree99f81051834beb625719c1842dde3541c4c52ac4
parentf3142c027212967e0417ad3377563bbc8f314fce (diff)
Fix build on zlib-less environments
Commit 4d57e8381677 added support for getting I/O errors out of zlib, but it introduced a portability problem for systems without zlib. Repair by wrapping the zlib call inside #ifdef and restore the original code in the other branch. This serves to illustrate the inadequacy of the zlib abstraction in pg_backup_archiver: there is no way to call gzerror() in that abstraction. This means that the several places that call GZREAD and GZWRITE are currently doing error reporting wrongly, but ENOTIME to get it fixed before next week's release set. Backpatch to 9.4, like the commit that introduced the problem.
-rw-r--r--src/bin/pg_dump/pg_backup_tar.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c
index 905429b9ef2..921918e3829 100644
--- a/src/bin/pg_dump/pg_backup_tar.c
+++ b/src/bin/pg_dump/pg_backup_tar.c
@@ -557,12 +557,18 @@ _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh)
res = GZREAD(&((char *) buf)[used], 1, len, th->zFH);
if (res != len && !GZEOF(th->zFH))
{
+#ifdef HAVE_LIBZ
int errnum;
const char *errmsg = gzerror(th->zFH, &errnum);
exit_horribly(modulename,
"could not read from input file: %s\n",
errnum == Z_ERRNO ? strerror(errno) : errmsg);
+#else
+ exit_horribly(modulename,
+ "could not read from input file: %s\n",
+ strerror(errno));
+#endif
}
}
else