*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.147 2007/10/13 20:18:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.148 2007/10/28 21:55:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
/* Setup the file */
fh = fopen(ropt->tocFile, PG_BINARY_R);
if (!fh)
- die_horribly(AH, modulename, "could not open TOC file: %s\n",
- strerror(errno));
+ die_horribly(AH, modulename, "could not open TOC file \"%s\": %s\n",
+ ropt->tocFile, strerror(errno));
while (fgets(buf, sizeof(buf), fh) != NULL)
{
}
if (!AH->OF)
- die_horribly(AH, modulename, "could not open output file: %s\n", strerror(errno));
+ {
+ if (filename)
+ die_horribly(AH, modulename, "could not open output file \"%s\": %s\n",
+ filename, strerror(errno));
+ else
+ die_horribly(AH, modulename, "could not open output file: %s\n",
+ strerror(errno));
+ }
return sav;
}
{
wantClose = 1;
fh = fopen(AH->fSpec, PG_BINARY_R);
+ if (!fh)
+ die_horribly(AH, modulename, "could not open input file \"%s\": %s\n",
+ AH->fSpec, strerror(errno));
}
else
+ {
fh = stdin;
-
- if (!fh)
- die_horribly(AH, modulename, "could not open input file: %s\n", strerror(errno));
+ if (!fh)
+ die_horribly(AH, modulename, "could not open input file: %s\n",
+ strerror(errno));
+ }
cnt = fread(sig, 1, 5, fh);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.39 2007/08/06 01:38:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.40 2007/10/28 21:55:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
if (AH->mode == archModeWrite)
{
if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
+ {
AH->FH = fopen(AH->fSpec, PG_BINARY_W);
+ if (!AH->FH)
+ die_horribly(AH, modulename, "could not open output file \"%s\": %s\n",
+ AH->fSpec, strerror(errno));
+ }
else
+ {
AH->FH = stdout;
-
- if (!AH->FH)
- die_horribly(AH, modulename, "could not open output file \"%s\": %s\n", AH->fSpec, strerror(errno));
+ if (!AH->FH)
+ die_horribly(AH, modulename, "could not open output file: %s\n",
+ strerror(errno));
+ }
ctx->hasSeek = checkSeek(AH->FH);
}
else
{
if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
+ {
AH->FH = fopen(AH->fSpec, PG_BINARY_R);
+ if (!AH->FH)
+ die_horribly(AH, modulename, "could not open input file \"%s\": %s\n",
+ AH->fSpec, strerror(errno));
+ }
else
+ {
AH->FH = stdin;
- if (!AH->FH)
- die_horribly(AH, modulename, "could not open input file \"%s\": %s\n", AH->fSpec, strerror(errno));
+ if (!AH->FH)
+ die_horribly(AH, modulename, "could not open input file: %s\n",
+ strerror(errno));
+ }
ctx->hasSeek = checkSeek(AH->FH);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.33 2007/08/06 01:38:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.34 2007/10/28 21:55:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
" normal use. Files will be written in the current working directory.\n");
if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
+ {
AH->FH = fopen(AH->fSpec, PG_BINARY_W);
+ if (AH->FH == NULL)
+ die_horribly(NULL, modulename, "could not open output file \"%s\": %s\n",
+ AH->fSpec, strerror(errno));
+ }
else
+ {
AH->FH = stdout;
-
- if (AH->FH == NULL)
- die_horribly(NULL, modulename, "could not open output file: %s\n", strerror(errno));
+ if (AH->FH == NULL)
+ die_horribly(NULL, modulename, "could not open output file: %s\n",
+ strerror(errno));
+ }
ctx->hasSeek = checkSeek(AH->FH);
{ /* Read Mode */
if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
+ {
AH->FH = fopen(AH->fSpec, PG_BINARY_R);
+ if (AH->FH == NULL)
+ die_horribly(NULL, modulename, "could not open input file \"%s\": %s\n",
+ AH->fSpec, strerror(errno));
+ }
else
+ {
AH->FH = stdin;
-
- if (AH->FH == NULL)
- die_horribly(NULL, modulename, "could not open input file: %s\n", strerror(errno));
+ if (AH->FH == NULL)
+ die_horribly(NULL, modulename, "could not open input file: %s\n",
+ strerror(errno));
+ }
ctx->hasSeek = checkSeek(AH->FH);
#endif
if (tctx->FH == NULL)
- die_horribly(AH, modulename, "could not open output file: %s\n", strerror(errno));
+ die_horribly(AH, modulename, "could not open output file \"%s\": %s\n",
+ tctx->filename, strerror(errno));
}
static size_t
#endif
if (AH->FH == NULL)
- die_horribly(AH, modulename, "could not open input file: %s\n", strerror(errno));
+ die_horribly(AH, modulename, "could not open input file \"%s\": %s\n",
+ filename, strerror(errno));
while ((cnt = GZREAD(buf, 1, 4095, AH->FH)) > 0)
{
#endif
if (tctx->FH == NULL)
- die_horribly(AH, modulename, "could not open large object file for input: %s\n", strerror(errno));
+ die_horribly(AH, modulename, "could not open large object file \"%s\" for input: %s\n",
+ fname, strerror(errno));
}
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.60 2007/08/29 16:31:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.61 2007/10/28 21:55:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*/
if (AH->mode == archModeWrite)
{
-
if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
+ {
ctx->tarFH = fopen(AH->fSpec, PG_BINARY_W);
+ if (ctx->tarFH == NULL)
+ die_horribly(NULL, modulename,
+ "could not open TOC file \"%s\" for output: %s\n",
+ AH->fSpec, strerror(errno));
+ }
else
+ {
ctx->tarFH = stdout;
-
- if (ctx->tarFH == NULL)
- die_horribly(NULL, modulename,
- "could not open TOC file for output: %s\n", strerror(errno));
+ if (ctx->tarFH == NULL)
+ die_horribly(NULL, modulename,
+ "could not open TOC file for output: %s\n",
+ strerror(errno));
+ }
ctx->tarFHpos = 0;
}
else
{ /* Read Mode */
-
if (AH->fSpec && strcmp(AH->fSpec, "") != 0)
+ {
ctx->tarFH = fopen(AH->fSpec, PG_BINARY_R);
+ if (ctx->tarFH == NULL)
+ die_horribly(NULL, modulename, "could not open TOC file \"%s\" for input: %s\n",
+ AH->fSpec, strerror(errno));
+ }
else
+ {
ctx->tarFH = stdin;
-
- if (ctx->tarFH == NULL)
- die_horribly(NULL, modulename, "could not open TOC file for input: %s\n", strerror(errno));
+ if (ctx->tarFH == NULL)
+ die_horribly(NULL, modulename, "could not open TOC file for input: %s\n",
+ strerror(errno));
+ }
/*
* Make unbuffered since we will dup() it, and the buffers screw each
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.93 2007/10/13 20:18:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.94 2007/10/28 21:55:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
OPF = fopen(filename, PG_BINARY_W);
if (!OPF)
{
- fprintf(stderr, _("%s: could not open the output file \"%s\"\n"),
- progname, filename);
+ fprintf(stderr, _("%s: could not open the output file \"%s\": %s\n"),
+ progname, filename, strerror(errno));
exit(1);
}
}
OPF = fopen(filename, PG_BINARY_A);
if (!OPF)
{
- fprintf(stderr, _("%s: could not re-open the output file \"%s\"\n"),
- progname, filename);
+ fprintf(stderr, _("%s: could not re-open the output file \"%s\": %s\n"),
+ progname, filename, strerror(errno));
exit(1);
}
}