git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 85bb81d)
Oops, the commit accept pg_controldata -D datadir missed code changes.
2014年10月24日 15:55:33 +0000 (18:55 +0300)
2014年10月24日 16:15:54 +0000 (19:15 +0300)
I updated the docs and usage blurp, but forgot to commit the code changes
required.

Spotted by Michael Paquier.


diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c
index 118e653b7972ccf7b3a75464807caf71010176ea..dd68f793c3d032e9dc17cb11974a0f270e4fc67e 100644 (file)
--- a/src/bin/pg_controldata/pg_controldata.c
+++ b/src/bin/pg_controldata/pg_controldata.c
@@ -90,7 +90,7 @@ main(int argc, char *argv[])
ControlFileData ControlFile;
int fd;
char ControlFilePath[MAXPGPATH];
- char *DataDir;
+ char *DataDir = NULL;
pg_crc32 crc;
time_t time_tmp;
char pgctime_str[128];
@@ -100,6 +100,7 @@ main(int argc, char *argv[])
const char *progname;
XLogSegNo segno;
char xlogfilename[MAXFNAMELEN];
+ int c;
set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_controldata"));
@@ -119,10 +120,28 @@ main(int argc, char *argv[])
}
}
- if (argc > 1)
- DataDir = argv[1];
- else
- DataDir = getenv("PGDATA");
+ while ((c = getopt(argc, argv, "D:")) != -1)
+ {
+ switch (c)
+ {
+ case 'D':
+ DataDir = optarg;
+ break;
+
+ default:
+ fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
+ exit(1);
+ }
+ }
+
+ if (DataDir == NULL)
+ {
+ if (optind < argc)
+ DataDir = argv[optind++];
+ else
+ DataDir = getenv("PGDATA");
+ }
+
if (DataDir == NULL)
{
fprintf(stderr, _("%s: no data directory specified\n"), progname);
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /