Skip to content

Commit 8a12aac

Browse files
committed
Minor style policing for error messages in pg_dump tar code. Notably, change
"dumping data out of order is not supported" to "restoring data out of order is not supported", because you get that error during pg_restore not pg_dump. Also fix some comments that didn't look so good after being pgindented as perhaps they did originally.
1 parent a548031 commit 8a12aac

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

src/bin/pg_dump/pg_backup_tar.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
*
1818
* IDENTIFICATION
19-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.67 2010/01/07 04:53:35 tgl Exp $
19+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.68 2010/02/23 16:55:22 tgl Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -211,8 +211,7 @@ InitArchiveFmt_Tar(ArchiveHandle *AH)
211211
* positioning.
212212
*/
213213
if (AH->compression != 0)
214-
die_horribly(NULL, modulename, "compression not supported by tar output format\n");
215-
214+
die_horribly(NULL, modulename, "compression is not supported by tar archive format\n");
216215
}
217216
else
218217
{ /* Read Mode */
@@ -348,25 +347,31 @@ tarOpen(ArchiveHandle *AH, const char *filename, char mode)
348347
tm = _tarPositionTo(AH, filename);
349348
if (!tm) /* Not found */
350349
{
351-
if (filename) /* Couldn't find the requested file. Future:
352-
* DO SEEK(0) and retry. */
353-
die_horribly(AH, modulename, "could not find file %s in archive\n", filename);
350+
if (filename)
351+
{
352+
/*
353+
* Couldn't find the requested file. Future:
354+
* do SEEK(0) and retry.
355+
*/
356+
die_horribly(AH, modulename, "could not find file \"%s\" in archive\n", filename);
357+
}
354358
else
355-
/* Any file OK, non left, so return NULL */
359+
{
360+
/* Any file OK, none left, so return NULL */
356361
return NULL;
362+
}
357363
}
358364

359365
#ifdef HAVE_LIBZ
360366

361367
if (AH->compression == 0)
362368
tm->nFH = ctx->tarFH;
363369
else
364-
die_horribly(AH, modulename, "compression support is disabled in this format\n");
370+
die_horribly(AH, modulename, "compression is not supported by tar archive format\n");
365371
/* tm->zFH = gzdopen(dup(fileno(ctx->tarFH)), "rb"); */
366372
#else
367373
tm->nFH = ctx->tarFH;
368374
#endif
369-
370375
}
371376
else
372377
{
@@ -414,7 +419,6 @@ tarOpen(ArchiveHandle *AH, const char *filename, char mode)
414419
tm->zFH = gzdopen(dup(fileno(tm->tmpFH)), fmode);
415420
if (tm->zFH == NULL)
416421
die_horribly(AH, modulename, "could not open temporary file\n");
417-
418422
}
419423
else
420424
tm->nFH = tm->tmpFH;
@@ -431,7 +435,6 @@ tarOpen(ArchiveHandle *AH, const char *filename, char mode)
431435
tm->tarFH = ctx->tarFH;
432436

433437
return tm;
434-
435438
}
436439

437440
static void
@@ -1150,20 +1153,19 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
11501153
ahlog(AH, 4, "now at file position %s\n", buf);
11511154
}
11521155

1153-
/* We are at the start of the file. or at the next member */
1156+
/* We are at the start of the file, or at the next member */
11541157

11551158
/* Get the header */
11561159
if (!_tarGetHeader(AH, th))
11571160
{
11581161
if (filename)
1159-
die_horribly(AH, modulename, "could not find header for file %s in tar archive\n", filename);
1162+
die_horribly(AH, modulename, "could not find header for file \"%s\" in tar archive\n", filename);
11601163
else
1161-
1164+
{
11621165
/*
1163-
* We're just scanning the archibe for the next file, so return
1166+
* We're just scanning the archive for the next file, so return
11641167
* null
11651168
*/
1166-
{
11671169
free(th);
11681170
return NULL;
11691171
}
@@ -1175,8 +1177,8 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
11751177

11761178
id = atoi(th->targetFile);
11771179
if ((TocIDRequired(AH, id, AH->ropt) & REQ_DATA) != 0)
1178-
die_horribly(AH, modulename, "dumping data out of order is not supported in this archive format: "
1179-
"%s is required, but comes before %s in the archive file.\n",
1180+
die_horribly(AH, modulename, "restoring data out of order is not supported in this archive format: "
1181+
"\"%s\" is required, but comes before \"%s\" in the archive file.\n",
11801182
th->targetFile, filename);
11811183

11821184
/* Header doesn't match, so read to next header */
@@ -1187,8 +1189,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename)
11871189
_tarReadRaw(AH, &header[0], 512, NULL, ctx->tarFH);
11881190

11891191
if (!_tarGetHeader(AH, th))
1190-
die_horribly(AH, modulename, "could not find header for file %s in tar archive\n", filename);
1191-
1192+
die_horribly(AH, modulename, "could not find header for file \"%s\" in tar archive\n", filename);
11921193
}
11931194

11941195
ctx->tarNextMember = ctx->tarFHpos + ((th->fileLen + 511) & ~511);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy