diff options
Diffstat (limited to 'src/bin/pg_dump/pg_backup_custom.c')
-rw-r--r-- | src/bin/pg_dump/pg_backup_custom.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c index 77d402c323e..c3b9c365d5c 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -153,13 +153,13 @@ InitArchiveFmt_Custom(ArchiveHandle *AH) { AH->FH = fopen(AH->fSpec, PG_BINARY_W); if (!AH->FH) - fatal("could not open output file \"%s\": %m", AH->fSpec); + pg_fatal("could not open output file \"%s\": %m", AH->fSpec); } else { AH->FH = stdout; if (!AH->FH) - fatal("could not open output file: %m"); + pg_fatal("could not open output file: %m"); } ctx->hasSeek = checkSeek(AH->FH); @@ -170,13 +170,13 @@ InitArchiveFmt_Custom(ArchiveHandle *AH) { AH->FH = fopen(AH->fSpec, PG_BINARY_R); if (!AH->FH) - fatal("could not open input file \"%s\": %m", AH->fSpec); + pg_fatal("could not open input file \"%s\": %m", AH->fSpec); } else { AH->FH = stdin; if (!AH->FH) - fatal("could not open input file: %m"); + pg_fatal("could not open input file: %m"); } ctx->hasSeek = checkSeek(AH->FH); @@ -373,7 +373,7 @@ _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid) lclContext *ctx = (lclContext *) AH->formatData; if (oid == 0) - fatal("invalid OID for large object"); + pg_fatal("invalid OID for large object"); WriteInt(AH, oid); @@ -436,7 +436,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te) if (ctx->hasSeek) { if (fseeko(AH->FH, ctx->lastFilePos, SEEK_SET) != 0) - fatal("error during file seek: %m"); + pg_fatal("error during file seek: %m"); } for (;;) @@ -492,8 +492,8 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te) break; default: /* Always have a default */ - fatal("unrecognized data block type (%d) while searching archive", - blkType); + pg_fatal("unrecognized data block type (%d) while searching archive", + blkType); break; } } @@ -502,7 +502,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te) { /* We can just seek to the place we need to be. */ if (fseeko(AH->FH, tctx->dataPos, SEEK_SET) != 0) - fatal("error during file seek: %m"); + pg_fatal("error during file seek: %m"); _readBlockHeader(AH, &blkType, &id); } @@ -514,20 +514,20 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te) if (blkType == EOF) { if (!ctx->hasSeek) - fatal("could not find block ID %d in archive -- " - "possibly due to out-of-order restore request, " - "which cannot be handled due to non-seekable input file", - te->dumpId); + pg_fatal("could not find block ID %d in archive -- " + "possibly due to out-of-order restore request, " + "which cannot be handled due to non-seekable input file", + te->dumpId); else - fatal("could not find block ID %d in archive -- " - "possibly corrupt archive", - te->dumpId); + pg_fatal("could not find block ID %d in archive -- " + "possibly corrupt archive", + te->dumpId); } /* Are we sane? */ if (id != te->dumpId) - fatal("found unexpected block ID (%d) when reading data -- expected %d", - id, te->dumpId); + pg_fatal("found unexpected block ID (%d) when reading data -- expected %d", + id, te->dumpId); switch (blkType) { @@ -540,8 +540,8 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te) break; default: /* Always have a default */ - fatal("unrecognized data block type %d while restoring archive", - blkType); + pg_fatal("unrecognized data block type %d while restoring archive", + blkType); break; } @@ -626,7 +626,7 @@ _skipData(ArchiveHandle *AH) if (ctx->hasSeek) { if (fseeko(AH->FH, blkLen, SEEK_CUR) != 0) - fatal("error during file seek: %m"); + pg_fatal("error during file seek: %m"); } else { @@ -640,9 +640,9 @@ _skipData(ArchiveHandle *AH) if (fread(buf, 1, blkLen, AH->FH) != blkLen) { if (feof(AH->FH)) - fatal("could not read from input file: end of file"); + pg_fatal("could not read from input file: end of file"); else - fatal("could not read from input file: %m"); + pg_fatal("could not read from input file: %m"); } } @@ -743,7 +743,7 @@ _CloseArchive(ArchiveHandle *AH) /* Remember TOC's seek position for use below */ tpos = ftello(AH->FH); if (tpos < 0 && ctx->hasSeek) - fatal("could not determine seek position in archive file: %m"); + pg_fatal("could not determine seek position in archive file: %m"); WriteToc(AH); WriteDataChunks(AH, NULL); @@ -759,7 +759,7 @@ _CloseArchive(ArchiveHandle *AH) } if (fclose(AH->FH) != 0) - fatal("could not close archive file: %m"); + pg_fatal("could not close archive file: %m"); /* Sync the output file if one is defined */ if (AH->dosync && AH->mode == archModeWrite && AH->fSpec) @@ -782,32 +782,32 @@ _ReopenArchive(ArchiveHandle *AH) pgoff_t tpos; if (AH->mode == archModeWrite) - fatal("can only reopen input archives"); + pg_fatal("can only reopen input archives"); /* * These two cases are user-facing errors since they represent unsupported * (but not invalid) use-cases. Word the error messages appropriately. */ if (AH->fSpec == NULL || strcmp(AH->fSpec, "") == 0) - fatal("parallel restore from standard input is not supported"); + pg_fatal("parallel restore from standard input is not supported"); if (!ctx->hasSeek) - fatal("parallel restore from non-seekable file is not supported"); + pg_fatal("parallel restore from non-seekable file is not supported"); tpos = ftello(AH->FH); if (tpos < 0) - fatal("could not determine seek position in archive file: %m"); + pg_fatal("could not determine seek position in archive file: %m"); #ifndef WIN32 if (fclose(AH->FH) != 0) - fatal("could not close archive file: %m"); + pg_fatal("could not close archive file: %m"); #endif AH->FH = fopen(AH->fSpec, PG_BINARY_R); if (!AH->FH) - fatal("could not open input file \"%s\": %m", AH->fSpec); + pg_fatal("could not open input file \"%s\": %m", AH->fSpec); if (fseeko(AH->FH, tpos, SEEK_SET) != 0) - fatal("could not set seek position in archive file: %m"); + pg_fatal("could not set seek position in archive file: %m"); } /* @@ -862,7 +862,7 @@ _PrepParallelRestore(ArchiveHandle *AH) pgoff_t endpos; if (fseeko(AH->FH, 0, SEEK_END) != 0) - fatal("error during file seek: %m"); + pg_fatal("error during file seek: %m"); endpos = ftello(AH->FH); if (endpos > prev_tctx->dataPos) prev_te->dataLength = endpos - prev_tctx->dataPos; @@ -886,7 +886,7 @@ _Clone(ArchiveHandle *AH) /* sanity check, shouldn't happen */ if (ctx->cs != NULL) - fatal("compressor active"); + pg_fatal("compressor active"); /* * We intentionally do not clone TOC-entry-local state: it's useful to @@ -940,7 +940,7 @@ _getFilePos(ArchiveHandle *AH, lclContext *ctx) { /* Not expected if we found we can seek. */ if (ctx->hasSeek) - fatal("could not determine seek position in archive file: %m"); + pg_fatal("could not determine seek position in archive file: %m"); } return pos; } @@ -956,7 +956,7 @@ _readBlockHeader(ArchiveHandle *AH, int *type, int *id) int byt; /* - * Note: if we are at EOF with a pre-1.3 input file, we'll fatal() inside + * Note: if we are at EOF with a pre-1.3 input file, we'll pg_fatal() inside * ReadInt rather than returning EOF. It doesn't seem worth jumping * through hoops to deal with that case better, because no such files are * likely to exist in the wild: only some 7.1 development versions of |