runtime_options.wal_keep_segments is prepopulated with default value

Explicitly track if setting came from command line parameter.
This commit is contained in:
Ian Barwick
2015-02-05 11:55:52 +09:00
parent d4578e023e
commit 1d28a2d08e

View File

@@ -131,6 +131,7 @@ main(int argc, char **argv)
int c, targ; int c, targ;
int action = NO_ACTION; int action = NO_ACTION;
bool check_master_config = false; bool check_master_config = false;
bool wal_keep_segments_used = false;
char *ptr = NULL; char *ptr = NULL;
progname = get_progname(argv[0]); progname = get_progname(argv[0]);
@@ -186,7 +187,10 @@ main(int argc, char **argv)
break; break;
case 'w': case 'w':
if (atoi(optarg) > 0) if (atoi(optarg) > 0)
{
strncpy(runtime_options.wal_keep_segments, optarg, MAXLEN); strncpy(runtime_options.wal_keep_segments, optarg, MAXLEN);
wal_keep_segments_used = true;
}
break; break;
case 'k': case 'k':
if (atoi(optarg) > 0) if (atoi(optarg) > 0)
@@ -449,7 +453,7 @@ main(int argc, char **argv)
* the version check for 9.4 or later will occur afterwards. * the version check for 9.4 or later will occur afterwards.
*/ */
if(options.use_replication_slots && strlen(runtime_options.wal_keep_segments)) if(options.use_replication_slots && wal_keep_segments_used)
{ {
log_warning(_("-w/--wal-keep-segments has no effect when replication slots in use\n")); log_warning(_("-w/--wal-keep-segments has no effect when replication slots in use\n"));
} }