On Sat, Sep 27, 2014 at 02:23:12PM -0400, Wietse Venema wrote:

> > +    if ((config_dir = safe_getenv(CONF_ENV_PATH)) != 0 &&
> > +    strcmp(config_dir, DEF_CONFIG_DIR) != 0) {
> 
> I prefer not to lie in software. Thus, config_dir will show up in
> "postconf -n" output when there is any override, regardless of
> whether it comes from main.cf, MAIL_CONF, or -c options, even
> if inherited from a multi-instane manager.

In other respects, is the rest of the patch sound (correct and
useful)? I am not advocating that the patch be adopted, just using
it to ask the question more precisely.  The upside is avoiding any
confusion as to why config_directory is showing up, even though it
is not actually set in main.cf.  The downside is that when the
compile-time main.cf is in some unexpected location (say /usr/local/etc),
postconf -n would not show this.  In all likelihood showing the
"extra" setting does more good than harm.

diff --git a/src/postconf/postconf_misc.c b/src/postconf/postconf_misc.c
index af55d14..0107651 100644
--- a/src/postconf/postconf_misc.c
+++ b/src/postconf/postconf_misc.c
@@ -51,7 +51,10 @@ 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) {
+       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