Commit a6427f1f authored by Robert Haas's avatar Robert Haas

Unbreak pg_resetxlog -l.

Fujii Masao
parent 2dfa87bc
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment