Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit832b6d0

Browse files
committed
Properly enforce pg_dump -F formation options; only single letter or
full words support, per report from Mark Stosberg.
1 parent8f65c02 commit832b6d0

File tree

1 file changed

+27
-32
lines changed

1 file changed

+27
-32
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*by PostgreSQL
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.461 2007/03/19 23:38:30 wieck Exp $
15+
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.462 2007/03/22 19:42:02 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -476,38 +476,33 @@ main(int argc, char **argv)
476476
}
477477

478478
/* open the output file */
479-
switch (format[0])
479+
if (strcasecmp(format,"a")==0||strcasecmp(format,"append")==0)
480480
{
481-
case'a':
482-
case'A':
483-
plainText=1;
484-
g_fout=CreateArchive(filename,archNull,0,archModeAppend);
485-
break;
486-
487-
case'c':
488-
case'C':
489-
g_fout=CreateArchive(filename,archCustom,compressLevel,archModeWrite);
490-
break;
491-
492-
case'f':
493-
case'F':
494-
g_fout=CreateArchive(filename,archFiles,compressLevel,archModeWrite);
495-
break;
496-
497-
case'p':
498-
case'P':
499-
plainText=1;
500-
g_fout=CreateArchive(filename,archNull,0,archModeWrite);
501-
break;
502-
503-
case't':
504-
case'T':
505-
g_fout=CreateArchive(filename,archTar,compressLevel,archModeWrite);
506-
break;
507-
508-
default:
509-
write_msg(NULL,"invalid output format \"%s\" specified\n",format);
510-
exit(1);
481+
/* not documented */
482+
plainText=1;
483+
g_fout=CreateArchive(filename,archNull,0,archModeAppend);
484+
}
485+
elseif (strcasecmp(format,"c")==0||strcasecmp(format,"custom")==0)
486+
g_fout=CreateArchive(filename,archCustom,compressLevel,archModeWrite);
487+
elseif (strcasecmp(format,"f")==0||strcasecmp(format,"file")==0)
488+
{
489+
/*
490+
*Dump files into the current directory; for demonstration only, not
491+
*documented.
492+
*/
493+
g_fout=CreateArchive(filename,archFiles,compressLevel,archModeWrite);
494+
}
495+
elseif (strcasecmp(format,"p")==0||strcasecmp(format,"plain")==0)
496+
{
497+
plainText=1;
498+
g_fout=CreateArchive(filename,archNull,0,archModeWrite);
499+
}
500+
elseif (strcasecmp(format,"t")==0||strcasecmp(format,"tar")==0)
501+
g_fout=CreateArchive(filename,archTar,compressLevel,archModeWrite);
502+
else
503+
{
504+
write_msg(NULL,"invalid output format \"%s\" specified\n",format);
505+
exit(1);
511506
}
512507

513508
if (g_fout==NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp