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

Commit22b743b

Browse files
committed
Oops, the commit accept pg_controldata -D datadir missed code changes.
I updated the docs and usage blurp, but forgot to commit the code changesrequired.Spotted by Michael Paquier.
1 parent85bb81d commit22b743b

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

‎src/bin/pg_controldata/pg_controldata.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ main(int argc, char *argv[])
9090
ControlFileDataControlFile;
9191
intfd;
9292
charControlFilePath[MAXPGPATH];
93-
char*DataDir;
93+
char*DataDir=NULL;
9494
pg_crc32crc;
9595
time_ttime_tmp;
9696
charpgctime_str[128];
@@ -100,6 +100,7 @@ main(int argc, char *argv[])
100100
constchar*progname;
101101
XLogSegNosegno;
102102
charxlogfilename[MAXFNAMELEN];
103+
intc;
103104

104105
set_pglocale_pgservice(argv[0],PG_TEXTDOMAIN("pg_controldata"));
105106

@@ -119,10 +120,28 @@ main(int argc, char *argv[])
119120
}
120121
}
121122

122-
if (argc>1)
123-
DataDir=argv[1];
124-
else
125-
DataDir=getenv("PGDATA");
123+
while ((c=getopt(argc,argv,"D:"))!=-1)
124+
{
125+
switch (c)
126+
{
127+
case'D':
128+
DataDir=optarg;
129+
break;
130+
131+
default:
132+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
133+
exit(1);
134+
}
135+
}
136+
137+
if (DataDir==NULL)
138+
{
139+
if (optind<argc)
140+
DataDir=argv[optind++];
141+
else
142+
DataDir=getenv("PGDATA");
143+
}
144+
126145
if (DataDir==NULL)
127146
{
128147
fprintf(stderr,_("%s: no data directory specified\n"),progname);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp