Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0b0baf2

Browse files
committed
Avoid crash in "postgres -C guc" for a GUC with a null string value.
Emit "(null)" instead, which was the behavior all along on platforms that don't crash, eg OS X. Per report from Jehan-Guillaume de Rorthais. Back-patch to 9.2 where -C option was introduced. Michael Paquier Report: <20160615204036.2d35d86a@firost>
1 parent b000afe commit 0b0baf2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/backend/postmaster/postmaster.c

+7-3
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,14 @@ PostmasterMain(int argc, char *argv[])
827827
if (output_config_variable != NULL)
828828
{
829829
/*
830-
* permission is handled because the user is reading inside the data
831-
* dir
830+
* "-C guc" was specified, so print GUC's value and exit. No extra
831+
* permission check is needed because the user is reading inside the
832+
* data dir.
832833
*/
833-
puts(GetConfigOption(output_config_variable, false, false));
834+
const char *config_val = GetConfigOption(output_config_variable,
835+
false, false);
836+
837+
puts(config_val ? config_val : "(null)");
834838
ExitPostmaster(0);
835839
}
836840

0 commit comments

Comments
 (0)