mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Unbreak pg_resetxlog -l.
Fujii Masao
This commit is contained in:
parent
2dfa87bcb6
commit
a6427f1f47
@ -86,9 +86,13 @@ main(int argc, char *argv[])
|
||||
Oid set_oid = 0;
|
||||
MultiXactId set_mxid = 0;
|
||||
MultiXactOffset set_mxoff = (MultiXactOffset) -1;
|
||||
uint32 minXlogTli = 0;
|
||||
uint32 minXlogTli = 0,
|
||||
minXlogId = 0,
|
||||
minXlogSeg = 0;
|
||||
XLogSegNo minXlogSegNo = 0;
|
||||
char *endptr;
|
||||
char *endptr2;
|
||||
char *endptr3;
|
||||
char *DataDir;
|
||||
int fd;
|
||||
char path[MAXPGPATH];
|
||||
@ -200,13 +204,28 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
if (strspn(optarg, "01234567890ABCDEFabcdef") != 24)
|
||||
minXlogTli = strtoul(optarg, &endptr, 0);
|
||||
if (endptr == optarg || *endptr != ',')
|
||||
{
|
||||
fprintf(stderr, _("%s: invalid argument for option -l\n"), progname);
|
||||
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
|
||||
exit(1);
|
||||
}
|
||||
XLogFromFileName(optarg, &minXlogTli, &minXlogSegNo);
|
||||
minXlogId = strtoul(endptr + 1, &endptr2, 0);
|
||||
if (endptr2 == endptr + 1 || *endptr2 != ',')
|
||||
{
|
||||
fprintf(stderr, _("%s: invalid argument for option -l\n"), progname);
|
||||
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
|
||||
exit(1);
|
||||
}
|
||||
minXlogSeg = strtoul(endptr2 + 1, &endptr3, 0);
|
||||
if (endptr3 == endptr2 + 1 || *endptr3 != '\0')
|
||||
{
|
||||
fprintf(stderr, _("%s: invalid argument for option -l\n"), progname);
|
||||
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
|
||||
exit(1);
|
||||
}
|
||||
minXlogSegNo = (uint64) minXlogId * XLogSegmentsPerXLogId + minXlogSeg;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user