Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
79e37103
Commit
79e37103
authored
May 22, 2006
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add strerror to pg_dump error messages where missing.
parent
e9cc5302
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
42 deletions
+51
-42
src/bin/pg_dump/common.c
src/bin/pg_dump/common.c
+3
-3
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.c
+11
-9
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_custom.c
+23
-14
src/bin/pg_dump/pg_backup_files.c
src/bin/pg_dump/pg_backup_files.c
+5
-5
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_backup_tar.c
+5
-7
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_dump/pg_dumpall.c
+4
-4
No files found.
src/bin/pg_dump/common.c
View file @
79e37103
...
...
@@ -11,7 +11,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -768,7 +768,7 @@ parseOidArray(const char *str, Oid *array, int arraysize)
{
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'
;
...
...
@@ -783,7 +783,7 @@ parseOidArray(const char *str, Oid *array, int arraysize)
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
;
...
...
src/bin/pg_dump/pg_backup_archiver.c
View file @
79e37103
...
...
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.12
7 2006/04/19 16:02:17 tgl
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.12
8 2006/05/22 11:21:54 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -122,7 +122,8 @@ CloseArchive(Archive *AHX)
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 */
...
...
@@ -306,7 +307,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
{
#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
);
...
...
@@ -774,7 +775,8 @@ SortTocFromFile(Archive *AHX, RestoreOptions *ropt)
/* 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
)
{
...
...
@@ -1066,7 +1068,7 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
{
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
)
...
...
@@ -1089,8 +1091,8 @@ ahwrite(const void *ptr, size_t size, size_t nmemb, ArchiveHandle *AH)
{
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
;
}
}
...
...
@@ -1321,7 +1323,7 @@ ReadOffset(ArchiveHandle *AH, off_t *o)
break
;
default:
die_horribly
(
AH
,
modulename
,
"
U
nexpected data offset flag %d
\n
"
,
offsetFlg
);
die_horribly
(
AH
,
modulename
,
"
u
nexpected data offset flag %d
\n
"
,
offsetFlg
);
}
/*
...
...
@@ -1556,7 +1558,7 @@ _discoverArchiveFormat(ArchiveHandle *AH)
/* 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
;
...
...
src/bin/pg_dump/pg_backup_custom.c
View file @
79e37103
...
...
@@ -19,7 +19,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.3
3 2005/10/15 02:49:38 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.3
4 2006/05/22 11:21:54 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -175,7 +175,7 @@ InitArchiveFmt_Custom(ArchiveHandle *AH)
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
);
}
...
...
@@ -186,7 +186,7 @@ InitArchiveFmt_Custom(ArchiveHandle *AH)
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
);
...
...
@@ -438,7 +438,7 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt)
{
if
((
TocIDRequired
(
AH
,
id
,
ropt
)
&
REQ_DATA
)
!=
0
)
die_horribly
(
AH
,
modulename
,
"
D
umping a specific TOC data block out of order is not supported"
"
d
umping a specific TOC data block out of order is not supported"
" without ID on this input stream (fseek required)
\n
"
);
switch
(
blkType
)
...
...
@@ -540,9 +540,14 @@ _PrintData(ArchiveHandle *AH)
cnt
=
fread
(
in
,
1
,
blkLen
,
AH
->
FH
);
if
(
cnt
!=
blkLen
)
{
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 data block -- expected %lu, got %lu
\n
"
,
(
unsigned
long
)
blkLen
,
(
unsigned
long
)
cnt
);
"could not read from input file: %s
\n
"
,
strerror
(
errno
));
}
ctx
->
filePos
+=
blkLen
;
...
...
@@ -663,9 +668,14 @@ _skipData(ArchiveHandle *AH)
}
cnt
=
fread
(
in
,
1
,
blkLen
,
AH
->
FH
);
if
(
cnt
!=
blkLen
)
{
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 data block -- expected %lu, got %lu
\n
"
,
(
unsigned
long
)
blkLen
,
(
unsigned
long
)
cnt
);
"could not read from input file: %s
\n
"
,
strerror
(
errno
));
}
ctx
->
filePos
+=
blkLen
;
...
...
@@ -736,8 +746,7 @@ _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len)
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
;
...
...
@@ -929,7 +938,7 @@ _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush)
*/
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
;
...
...
@@ -943,7 +952,7 @@ _DoDeflate(ArchiveHandle *AH, lclContext *ctx, int flush)
{
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
;
}
...
...
src/bin/pg_dump/pg_backup_files.c
View file @
79e37103
...
...
@@ -20,7 +20,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.2
7 2005/10/15 02:49:38 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_files.c,v 1.2
8 2006/05/22 11:21:54 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -243,7 +243,7 @@ _StartData(ArchiveHandle *AH, TocEntry *te)
#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
...
...
@@ -287,7 +287,7 @@ _PrintFileData(ArchiveHandle *AH, char *filename, RestoreOptions *ropt)
#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
)
{
...
...
@@ -411,7 +411,7 @@ _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len)
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
;
...
...
@@ -508,7 +508,7 @@ _StartBlob(ArchiveHandle *AH, TocEntry *te, Oid oid)
#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
)
);
}
/*
...
...
src/bin/pg_dump/pg_backup_tar.c
View file @
79e37103
...
...
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.5
0 2006/02/12 06:11:50 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_tar.c,v 1.5
1 2006/05/22 11:21:54 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -546,8 +546,7 @@ tarWrite(const void *buf, size_t len, TAR_MEMBER *th)
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
;
...
...
@@ -1035,13 +1034,12 @@ _tarAddFile(ArchiveHandle *AH, TAR_MEMBER *th)
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 t
ar member
: %s
\n
"
,
strerror
(
errno
));
die_horribly
(
AH
,
modulename
,
"could not close t
emporary file
: %s
\n
"
,
strerror
(
errno
));
if
(
len
!=
th
->
fileLen
)
{
...
...
@@ -1327,6 +1325,6 @@ _tarWriteHeader(TAR_MEMBER *th)
}
if
(
fwrite
(
h
,
1
,
512
,
th
->
tarFH
)
!=
512
)
die_horribly
(
th
->
AH
,
modulename
,
"could not write t
ar header
\n
"
);
die_horribly
(
th
->
AH
,
modulename
,
"could not write t
o output file: %s
\n
"
,
strerror
(
errno
)
);
}
src/bin/pg_dump/pg_dumpall.c
View file @
79e37103
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.7
4 2006/04/07 21:26:29 tgl
Exp $
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.7
5 2006/05/22 11:21:54 petere
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -38,8 +38,8 @@ int optreset;
#include "pqexpbuffer.h"
/* version string we expect back from p
ostgres
*/
#define PG_VERSIONSTR "pg_dump (PostgreSQL) " PG_VERSION "\n"
/* version string we expect back from p
g_dump
*/
#define PG
DUMP
_VERSIONSTR "pg_dump (PostgreSQL) " PG_VERSION "\n"
static
const
char
*
progname
;
...
...
@@ -142,7 +142,7 @@ main(int argc, char *argv[])
}
}
if
((
ret
=
find_other_exec
(
argv
[
0
],
"pg_dump"
,
PG_VERSIONSTR
,
if
((
ret
=
find_other_exec
(
argv
[
0
],
"pg_dump"
,
PG
DUMP
_VERSIONSTR
,
pg_dump_bin
))
<
0
)
{
char
full_path
[
MAXPGPATH
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment