pg_dump-zlib-fix.patch
text/x-patch
Filename: pg_dump-zlib-fix.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/bin/pg_dump/pg_backup_files.c | 10 | 5 |
diff --git i/src/bin/pg_dump/pg_backup_files.c w/src/bin/pg_dump/pg_backup_files.c
index a7fd91d..32b2a32 100644
--- i/src/bin/pg_dump/pg_backup_files.c
+++ w/src/bin/pg_dump/pg_backup_files.c
@@ -293,27 +293,32 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
{
char buf[4096];
size_t cnt;
+#ifdef HAVE_LIBZ
+ gzFile fh;
+#else
+ FILE *fh;
+#endif
if (!filename)
return;
#ifdef HAVE_LIBZ
- AH->FH = gzopen(filename, "rb");
+ fh = gzopen(filename, "rb");
#else
- AH->FH = fopen(filename, PG_BINARY_R);
+ fh = fopen(filename, PG_BINARY_R);
#endif
- if (AH->FH == NULL)
+ if (!fh)
die_horribly(AH, modulename, "could not open input file \"%s\": %s\n",
filename, strerror(errno));
- while ((cnt = GZREAD(buf, 1, 4095, AH->FH)) > 0)
+ while ((cnt = GZREAD(buf, 1, 4095, fh)) > 0)
{
buf[cnt] = '\0';
ahwrite(buf, 1, cnt, AH);
}
- if (GZCLOSE(AH->FH) != 0)
+ if (GZCLOSE(fh) != 0)
die_horribly(AH, modulename, "could not close data file after reading\n");
}