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

Commit0856cdf

Browse files
committed
Fix a couple of bugs involving calling fmtID() twice in
a single printf() ... it'd work if fmtId() didn't use a static return area...
1 parentd85df9c commit0856cdf

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.94 1998/11/06 15:54:47 thomas Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.95 1998/11/15 07:09:13 tgl Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -2563,15 +2563,16 @@ dumpACL(FILE *fout, TableInfo tbinfo)
25632563
{
25642564
if (ACLlist[k].privledges!= (char*)NULL)
25652565
{
2566+
/* If you change this code, bear in mind fmtId() can be
2567+
* used only once per printf() call...
2568+
*/
2569+
fprintf(fout,
2570+
"GRANT %s on %s to ",
2571+
ACLlist[k].privledges,fmtId(tbinfo.relname));
25662572
if (ACLlist[k].user== (char*)NULL)
2567-
fprintf(fout,
2568-
"GRANT %s on %s to PUBLIC;\n",
2569-
ACLlist[k].privledges,fmtId(tbinfo.relname));
2573+
fprintf(fout,"PUBLIC;\n");
25702574
else
2571-
fprintf(fout,
2572-
"GRANT %s on %s to %s;\n",
2573-
ACLlist[k].privledges,fmtId(tbinfo.relname),
2574-
fmtId(ACLlist[k].user));
2575+
fprintf(fout,"%s;\n",fmtId(ACLlist[k].user));
25752576
}
25762577
}
25772578
}
@@ -2851,23 +2852,21 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
28512852

28522853
strcpy(id1,fmtId(indinfo[i].indexrelname));
28532854
strcpy(id2,fmtId(indinfo[i].indrelname));
2854-
sprintf(q,"CREATE %s INDEX %s on %s using %s (",
2855+
fprintf(fout,"CREATE %s INDEX %s on %s using %s (",
28552856
(strcmp(indinfo[i].indisunique,"t")==0) ?"UNIQUE" :"",
28562857
id1,
28572858
id2,
28582859
indinfo[i].indamname);
28592860
if (funcname)
28602861
{
2861-
sprintf(q,"%s %s (%s) %s );\n",
2862-
q,fmtId(funcname),attlist,fmtId(classname[0]));
2862+
/* need 2 printf's here cuz fmtId has static return area */
2863+
fprintf(fout," %s",fmtId(funcname));
2864+
fprintf(fout," (%s) %s );\n",attlist,fmtId(classname[0]));
28632865
free(funcname);
28642866
free(classname[0]);
28652867
}
28662868
else
2867-
sprintf(q,"%s %s );\n",
2868-
q,attlist);
2869-
2870-
fputs(q,fout);
2869+
fprintf(fout," %s );\n",attlist);
28712870
}
28722871
}
28732872

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp