Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6118400

Browse files
committed
Fix build on zlib-less environments
Commit 4d57e83 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.
1 parent 1f220c3 commit 6118400

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/bin/pg_dump/pg_backup_tar.c

+6
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,18 @@ _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh)
558558
res = GZREAD(&((char *) buf)[used], 1, len, th->zFH);
559559
if (res != len && !GZEOF(th->zFH))
560560
{
561+
#ifdef HAVE_LIBZ
561562
int errnum;
562563
const char *errmsg = gzerror(th->zFH, &errnum);
563564

564565
exit_horribly(modulename,
565566
"could not read from input file: %s\n",
566567
errnum == Z_ERRNO ? strerror(errno) : errmsg);
568+
#else
569+
exit_horribly(modulename,
570+
"could not read from input file: %s\n",
571+
strerror(errno));
572+
#endif
567573
}
568574
}
569575
else

0 commit comments

Comments
 (0)