s3-winbindd: call dump_core_setup after command line option has been parsed
[samba.git] / source3 / winbindd / winbindd.c
index 0550da87d29df216e741a64fee11313682b515bb..ca5a53be7f7d9ade913eaf725f6e7c47e9a04943 100644 (file)
@@ -1073,6 +1073,15 @@ int main(int argc, char **argv, char **envp)
                }
        }
 
+       /* We call dump_core_setup one more time because the command line can
+        * set the log file or the log-basename and this will influence where
+        * cores are stored. Without this call get_dyn_LOGFILEBASE will be
+        * the default value derived from build's prefix. For EOM this value
+        * is often not related to the path where winbindd is actually run
+        * in production.
+        */
+       dump_core_setup("winbindd");
+
        if (is_daemon && interactive) {
                d_fprintf(stderr,"\nERROR: "
                          "Option -i|--interactive is not allowed together with -D|--daemon\n\n");
@@ -1107,6 +1116,11 @@ int main(int argc, char **argv, char **envp)
                DEBUG(0, ("error opening config file\n"));
                exit(1);
        }
+       /* After parsing the configuration file we setup the core path one more time
+        * as the log file might have been set in the configuration and cores's
+        * path is by default basename(lp_logfile()).
+        */
+       dump_core_setup("winbindd");
 
        /* Initialise messaging system */