On Sat, Sep 27, 2014 at 11:41:08AM -0400, b...@bitrate.net wrote:

> you read my mind.  thanks for this detail.

If nevertheless it is desirable to have "postconf -n" suppress any
"external" value of "config_directory" for the primary instance,
then the patch below may do the job.  It is not clear that having
config_directory reported for secondary instances and not reported
for the primary instance is an improvement.  Suppression in secondary
instances would require code changes out of proportion to any
plausible benefit.

diff --git a/src/postconf/postconf_misc.c b/src/postconf/postconf_misc.c
index af55d14..8e3bc42 100644
--- a/src/postconf/postconf_misc.c
+++ b/src/postconf/postconf_misc.c
@@ -28,6 +28,7 @@
 /* System library. */
 
 #include <sys_defs.h>
+#include <string.h>
 
 /* Utility library. */
 
@@ -51,7 +52,11 @@ void    pcf_set_config_dir(void)
 
     if (var_config_dir)
        myfree(var_config_dir);
-    var_config_dir = mystrdup((config_dir = safe_getenv(CONF_ENV_PATH)) != 0 ?
-                             config_dir : DEF_CONFIG_DIR);     /* XXX */
-    set_mail_conf_str(VAR_CONFIG_DIR, var_config_dir);
+    if ((config_dir = safe_getenv(CONF_ENV_PATH)) != 0 &&
+        strcmp(config_dir, DEF_CONFIG_DIR) != 0) {
+       var_config_dir = mystrdup(config_dir);
+       set_mail_conf_str(VAR_CONFIG_DIR, var_config_dir);
+    } else {
+       var_config_dir = mystrdup(DEF_CONFIG_DIR);
+    }
 }

-- 
        Viktor.

Reply via email to