*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.89 2006/03/05 15:58:50 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/common.c,v 1.90 2006/05/22 11:21:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
{
if (argNum >= arraysize)
{
- write_msg(NULL, "could not parse numeric array: too many numbers\n");
+ write_msg(NULL, "could not parse numeric array \"%s\": too many numbers\n", str);
exit_nicely();
}
temp[j] = '\0';
if (!(isdigit((unsigned char) s) || s == '-') ||
j >= sizeof(temp) - 1)
{
- write_msg(NULL, "could not parse numeric array: invalid character in number\n");
+ write_msg(NULL, "could not parse numeric array \"%s\": invalid character in number\n", str);
exit_nicely();
}
temp[j++] = s;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.127 2006/04/19 16:02:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.128 2006/05/22 11:21:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
res = fclose(AH->OF);
if (res != 0)
- die_horribly(AH, modulename, "could not close output archive file\n");
+ die_horribly(AH, modulename, "could not close output file: %s\n",
+ strerror(errno));
}
/* Public */
{
#ifndef HAVE_LIBZ
if (AH->compression != 0)
- die_horribly(AH, modulename, "cannot restore from compressed archive (not configured for compression support)\n");
+ die_horribly(AH, modulename, "cannot restore from compressed archive (compression not supported in this installation)\n");
#endif
_printTocEntry(AH, te, ropt, true, false);
/* Setup the file */
fh = fopen(ropt->tocFile, PG_BINARY_R);
if (!fh)
- die_horribly(AH, modulename, "could not open TOC file\n");
+ die_horribly(AH, modulename, "could not open TOC file: %s\n",
+ strerror(errno));
while (fgets(buf, sizeof(buf), fh) != NULL)
{
{
res = GZWRITE((void *) ptr, size, nmemb, AH->OF);
if (res != (nmemb * size))
- die_horribly(AH, modulename, "could not write to compressed archive\n");
+ die_horribly(AH, modulename, "could not write to output file: %s\n", strerror(errno));
return res;
}
else if (AH->CustomOutPtr)
{
res = fwrite((void *) ptr, size, nmemb, AH->OF);
if (res != nmemb)
- die_horribly(AH, modulename, "could not write to output file (%lu != %lu)\n",
- (unsigned long) res, (unsigned long) nmemb);
+ die_horribly(AH, modulename, "could not write to output file: %s\n",
+ strerror(errno));
return res;
}
}
break;
default:
- die_horribly(AH, modulename, "Unexpected data offset flag %d\n", offsetFlg);
+ die_horribly(AH, modulename, "unexpected data offset flag %d\n", offsetFlg);
}
/*
/* Close the file */
if (wantClose)
if (fclose(fh) != 0)
- die_horribly(AH, modulename, "could not close the input file after reading header: %s\n",
+ die_horribly(AH, modulename, "could not close input file: %s\n",
strerror(errno));
return AH->format;
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.33 2005/10/15 02:49:38 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.34 2006/05/22 11:21:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
AH->FH = stdout;
if (!AH->FH)
- die_horribly(AH, modulename, "could not open archive file \"%s\": %s\n", AH->fSpec, strerror(errno));
+ die_horribly(AH, modulename, "could not open output file \"%s\": %s\n", AH->fSpec, strerror(errno));
ctx->hasSeek = checkSeek(AH->FH);
}
else
AH->FH = stdin;
if (!AH->FH)
- die_horribly(AH, modulename, "could not open archive file \"%s\": %s\n", AH->fSpec, strerror(errno));
+ die_horribly(AH, modulename, "could not open input file \"%s\": %s\n", AH->fSpec, strerror(errno));
ctx->hasSeek = checkSeek(AH->FH);
{
if ((TocIDRequired(AH, id, ropt) & REQ_DATA) != 0)
die_horribly(AH, modulename,
- "Dumping a specific TOC data block out of order is not supported"
+ "dumping a specific TOC data block out of order is not supported"
" without ID on this input stream (fseek required)\n");
switch (blkType)
cnt = fread(in, 1, blkLen, AH->FH);
if (cnt != blkLen)
- die_horribly(AH, modulename,
- "could not read data block -- expected %lu, got %lu\n",
- (unsigned long) blkLen, (unsigned long) cnt);
+ {
+ if (feof(AH->FH))
+ die_horribly(AH, modulename,
+ "could not read from input file: end of file\n");
+ else
+ die_horribly(AH, modulename,
+ "could not read from input file: %s\n", strerror(errno));
+ }
ctx->filePos += blkLen;
}
cnt = fread(in, 1, blkLen, AH->FH);
if (cnt != blkLen)
- die_horribly(AH, modulename,
- "could not read data block -- expected %lu, got %lu\n",
- (unsigned long) blkLen, (unsigned long) cnt);
+ {
+ if (feof(AH->FH))
+ die_horribly(AH, modulename,
+ "could not read from input file: end of file\n");
+ else
+ die_horribly(AH, modulename,
+ "could not read from input file: %s\n", strerror(errno));
+ }
ctx->filePos += blkLen;
if (res != len)
die_horribly(AH, modulename,
- "write error in _WriteBuf (%lu != %lu)\n",
- (unsigned long) res, (unsigned long) len);
+ "could not write to output file: %s\n", strerror(errno));
ctx->filePos += res;
return res;
*/
WriteInt(AH, zlibOutSize - zp->avail_out);
if (fwrite(out, 1, zlibOutSize - zp->avail_out, AH->FH) != (zlibOutSize - zp->avail_out))
- die_horribly(AH, modulename, "could not write compressed chunk\n");
+ die_horribly(AH, modulename, "could not write to output file: %s\n", strerror(errno));
ctx->filePos += zlibOutSize - zp->avail_out;
}
zp->next_out = (void *) out;
{
WriteInt(AH, zp->avail_in);
if (fwrite(zp->next_in, 1, zp->avail_in, AH->FH) != zp->avail_in)
- die_horribly(AH, modulename, "could not write uncompressed chunk\n");
+ die_horribly(AH, modulename, "could not write to output file: %s\n", strerror(errno));
ctx->filePos += zp->avail_in;
zp->avail_in = 0;
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.27 2005/10/15 02:49:38 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.28 2006/05/22 11:21:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
#endif
if (tctx->FH == NULL)
- die_horribly(AH, modulename, "could not open data file for output\n");
+ die_horribly(AH, modulename, "could not open output file: %s\n", strerror(errno));
}
static size_t
#endif
if (AH->FH == NULL)
- die_horribly(AH, modulename, "could not open data file for input\n");
+ die_horribly(AH, modulename, "could not open input file: %s\n", strerror(errno));
while ((cnt = GZREAD(buf, 1, 4095, AH->FH)) > 0)
{
res = fwrite(buf, 1, len, AH->FH);
if (res != len)
- die_horribly(AH, modulename, "write error in _WriteBuf (%lu != %lu)\n", (unsigned long) res, (unsigned long) len);
+ die_horribly(AH, modulename, "could not write to output file: %s\n", strerror(errno));
ctx->filePos += res;
return res;
#endif
if (tctx->FH == NULL)
- die_horribly(AH, modulename, "could not open large object file\n");
+ die_horribly(AH, modulename, "could not open large object file for input: %s\n", strerror(errno));
}
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.50 2006/02/12 06:11:50 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.51 2006/05/22 11:21:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
if (res != len)
die_horribly(th->AH, modulename,
- "could not write to tar member (wrote %lu, attempted %lu)\n",
- (unsigned long) res, (unsigned long) len);
+ "could not write to output file: %s\n", strerror(errno));
th->pos += res;
return res;
res = fwrite(&buf[0], 1, cnt, th->tarFH);
if (res != cnt)
die_horribly(AH, modulename,
- "write error appending to tar archive (wrote %lu, attempted %lu)\n",
- (unsigned long) res, (unsigned long) cnt);
+ "could not write to output file: %s\n", strerror(errno));
len += res;
}
if (fclose(tmp) != 0) /* This *should* delete it... */
- die_horribly(AH, modulename, "could not close tar member: %s\n", strerror(errno));
+ die_horribly(AH, modulename, "could not close temporary file: %s\n", strerror(errno));
if (len != th->fileLen)
{
}
if (fwrite(h, 1, 512, th->tarFH) != 512)
- die_horribly(th->AH, modulename, "could not write tar header\n");
+ die_horribly(th->AH, modulename, "could not write to output file: %s\n", strerror(errno));
}
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.74 2006/04/07 21:26:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.75 2006/05/22 11:21:54 petere Exp $
*
*-------------------------------------------------------------------------
*/
#include "pqexpbuffer.h"
-/* version string we expect back from postgres */
-#define PG_VERSIONSTR "pg_dump (PostgreSQL) " PG_VERSION "\n"
+/* version string we expect back from pg_dump */
+#define PGDUMP_VERSIONSTR "pg_dump (PostgreSQL) " PG_VERSION "\n"
static const char *progname;
}
}
- if ((ret = find_other_exec(argv[0], "pg_dump", PG_VERSIONSTR,
+ if ((ret = find_other_exec(argv[0], "pg_dump", PGDUMP_VERSIONSTR,
pg_dump_bin)) < 0)
{
char full_path[MAXPGPATH];