summaryrefslogtreecommitdiff
path: root/src/bin/pg_dump/pg_backup_tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_dump/pg_backup_tar.c')
-rw-r--r--src/bin/pg_dump/pg_backup_tar.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c
index c40dfe5726a..eb5bcbb0e31 100644
--- a/src/bin/pg_dump/pg_backup_tar.c
+++ b/src/bin/pg_dump/pg_backup_tar.c
@@ -47,8 +47,8 @@ static int _WriteByte(ArchiveHandle *AH, const int i);
static int _ReadByte(ArchiveHandle *);
static void _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len);
static void _ReadBuf(ArchiveHandle *AH, void *buf, size_t len);
-static void _CloseArchive(ArchiveHandle *AH, DumpOptions *dopt);
-static void _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt);
+static void _CloseArchive(ArchiveHandle *AH);
+static void _PrintTocData(ArchiveHandle *AH, TocEntry *te);
static void _WriteExtraToc(ArchiveHandle *AH, TocEntry *te);
static void _ReadExtraToc(ArchiveHandle *AH, TocEntry *te);
static void _PrintExtraToc(ArchiveHandle *AH, TocEntry *te);
@@ -100,7 +100,7 @@ typedef struct
/* translator: this is a module name */
static const char *modulename = gettext_noop("tar archiver");
-static void _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt);
+static void _LoadBlobs(ArchiveHandle *AH);
static TAR_MEMBER *tarOpen(ArchiveHandle *AH, const char *filename, char mode);
static void tarClose(ArchiveHandle *AH, TAR_MEMBER *TH);
@@ -632,7 +632,7 @@ _EndData(ArchiveHandle *AH, TocEntry *te)
* Print data for a given file
*/
static void
-_PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
+_PrintFileData(ArchiveHandle *AH, char *filename)
{
lclContext *ctx = (lclContext *) AH->formatData;
char buf[4096];
@@ -659,7 +659,7 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
* Print data for a given TOC entry
*/
static void
-_PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
+_PrintTocData(ArchiveHandle *AH, TocEntry *te)
{
lclContext *ctx = (lclContext *) AH->formatData;
lclTocEntry *tctx = (lclTocEntry *) te->formatData;
@@ -708,13 +708,13 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
}
if (strcmp(te->desc, "BLOBS") == 0)
- _LoadBlobs(AH, ropt);
+ _LoadBlobs(AH);
else
- _PrintFileData(AH, tctx->filename, ropt);
+ _PrintFileData(AH, tctx->filename);
}
static void
-_LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
+_LoadBlobs(ArchiveHandle *AH)
{
Oid oid;
lclContext *ctx = (lclContext *) AH->formatData;
@@ -737,7 +737,7 @@ _LoadBlobs(ArchiveHandle *AH, RestoreOptions *ropt)
{
ahlog(AH, 1, "restoring large object with OID %u\n", oid);
- StartRestoreBlob(AH, oid, ropt->dropSchema);
+ StartRestoreBlob(AH, oid, AH->public.ropt->dropSchema);
while ((cnt = tarRead(buf, 4095, th)) > 0)
{
@@ -824,12 +824,13 @@ _ReadBuf(ArchiveHandle *AH, void *buf, size_t len)
}
static void
-_CloseArchive(ArchiveHandle *AH, DumpOptions *dopt)
+_CloseArchive(ArchiveHandle *AH)
{
lclContext *ctx = (lclContext *) AH->formatData;
TAR_MEMBER *th;
RestoreOptions *ropt;
RestoreOptions *savRopt;
+ DumpOptions *savDopt;
int savVerbose,
i;
@@ -847,7 +848,7 @@ _CloseArchive(ArchiveHandle *AH, DumpOptions *dopt)
/*
* Now send the data (tables & blobs)
*/
- WriteDataChunks(AH, dopt, NULL);
+ WriteDataChunks(AH, NULL);
/*
* Now this format wants to append a script which does a full restore
@@ -869,22 +870,25 @@ _CloseArchive(ArchiveHandle *AH, DumpOptions *dopt)
ctx->scriptTH = th;
ropt = NewRestoreOptions();
- memcpy(ropt, AH->ropt, sizeof(RestoreOptions));
+ memcpy(ropt, AH->public.ropt, sizeof(RestoreOptions));
ropt->filename = NULL;
ropt->dropSchema = 1;
ropt->compression = 0;
ropt->superuser = NULL;
ropt->suppressDumpWarnings = true;
- savRopt = AH->ropt;
- AH->ropt = ropt;
+ savDopt = AH->public.dopt;
+ savRopt = AH->public.ropt;
+
+ SetArchiveOptions((Archive *) AH, NULL, ropt);
savVerbose = AH->public.verbose;
AH->public.verbose = 0;
RestoreArchive((Archive *) AH);
- AH->ropt = savRopt;
+ SetArchiveOptions((Archive *) AH, savDopt, savRopt);
+
AH->public.verbose = savVerbose;
tarClose(AH, th);