File tree 2 files changed +15
-10
lines changed
2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -2560,12 +2560,20 @@ where
2560
2560
tracing:: warn!( "failed to parse the startup options: {options}" ) ;
2561
2561
break ;
2562
2562
}
2563
- } else if parsing_config {
2564
- let Some ( ( key, value) ) = item. split_once ( '=' ) else {
2563
+ } else if item . starts_with ( "-c" ) || parsing_config {
2564
+ let Some ( ( mut key, value) ) = item. split_once ( '=' ) else {
2565
2565
// "-c" followed with an invalid option
2566
2566
tracing:: warn!( "failed to parse the startup options: {options}" ) ;
2567
2567
break ;
2568
2568
} ;
2569
+ if !parsing_config {
2570
+ // Parse "-coptions=X"
2571
+ let Some ( stripped_key) = key. strip_prefix ( "-c" ) else {
2572
+ tracing:: warn!( "failed to parse the startup options: {options}" ) ;
2573
+ break ;
2574
+ } ;
2575
+ key = stripped_key;
2576
+ }
2569
2577
if key == "neon.endpoint_type" {
2570
2578
Span :: current ( ) . record ( "endpoint_type" , field:: display ( value) ) ;
2571
2579
} else {
Original file line number Diff line number Diff line change @@ -407,8 +407,8 @@ pageserver_connect(shardno_t shard_no, int elevel)
407
407
{
408
408
const char * keywords [5 ];
409
409
const char * values [5 ];
410
- char pid_str [16 ];
411
- char endpoint_str [36 ];
410
+ char pid_str [16 ] = { 0 } ;
411
+ char endpoint_str [36 ] = { 0 } ;
412
412
int n_pgsql_params ;
413
413
TimestampTz now ;
414
414
int64 us_since_last_attempt ;
@@ -481,25 +481,22 @@ pageserver_connect(shardno_t shard_no, int elevel)
481
481
}
482
482
483
483
{
484
- int ret = 0 ;
485
484
bool param_set = false;
486
485
switch (neon_endpoint_type )
487
486
{
488
487
case EP_TYPE_PRIMARY :
489
- ret = snprintf (endpoint_str , sizeof ( endpoint_str ), "-c neon.endpoint_type=primary" );
488
+ strncpy (endpoint_str , "-c neon.endpoint_type=primary" , sizeof ( endpoint_str ) );
490
489
param_set = true;
491
490
break ;
492
491
case EP_TYPE_REPLICA :
493
- ret = snprintf (endpoint_str , sizeof ( endpoint_str ), "-c neon.endpoint_type=replica" );
492
+ strncpy (endpoint_str , "-c neon.endpoint_type=replica" , sizeof ( endpoint_str ) );
494
493
param_set = true;
495
494
break ;
496
495
case EP_TYPE_STATIC :
497
- ret = snprintf (endpoint_str , sizeof ( endpoint_str ), "-c neon.endpoint_type=static" );
496
+ strncpy (endpoint_str , "-c neon.endpoint_type=static" , sizeof ( endpoint_str ) );
498
497
param_set = true;
499
498
break ;
500
499
}
501
- if (ret < 0 || ret >= (int )(sizeof (endpoint_str )))
502
- elog (FATAL , "stack-allocated buffer too small to hold endpoint type" );
503
500
if (param_set )
504
501
{
505
502
keywords [n_pgsql_params ] = "options" ;
You can’t perform that action at this time.
0 commit comments