Skip to content

Commit 4f5995d

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 455812d commit 4f5995d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,10 +821,14 @@ PostmasterMain(int argc, char *argv[])
821821
if (output_config_variable != NULL)
822822
{
823823
/*
824-
* permission is handled because the user is reading inside the data
825-
* dir
824+
* "-C guc" was specified, so print GUC's value and exit. No extra
825+
* permission check is needed because the user is reading inside the
826+
* data dir.
826827
*/
827-
puts(GetConfigOption(output_config_variable, false, false));
828+
const char *config_val = GetConfigOption(output_config_variable,
829+
false, false);
830+
831+
puts(config_val ? config_val : "(null)");
828832
ExitPostmaster(0);
829833
}
830834

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy