From db0c7fae77b60857adf9dd083a1b6ce524a6808f Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 11 Jun 2007 22:56:53 +0000 Subject: Fix double printing of 'setting log file' and 'setting config file' paths. Add comment about not using direct pointer from GetCommandLine() git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7278 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 3fe830b13..7d2fd2ad4 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -78,7 +78,12 @@ DWORD WindowsForkStart(InspIRCd * Instance) // Launch our "forked" process. BOOL bSuccess = CreateProcess ( module, // Module (exe) filename - strdup(GetCommandLine()), // Command line (exe plus parameters from the OS) + strdup(GetCommandLine()), // Command line (exe plus parameters from the OS) + // NOTE: We cannot return the direct value of the + // GetCommandLine function here, as the pointer is + // passed straight to the child process, and will be + // invalid once we exit as it goes out of context. + // strdup() seems ok, though. 0, // PROCESS_SECURITY_ATTRIBUTES 0, // THREAD_SECURITY_ATTRIBUTES TRUE, // We went to inherit handles. @@ -499,12 +504,14 @@ InspIRCd::InspIRCd(int argc, char** argv) case 'f': /* Log filename was set */ strlcpy(LogFileName, optarg, MAXBUF); - printf("LOG: Setting logfile to %s\n", LogFileName); + if (owner_processid) + printf("LOG: Setting logfile to %s\n", LogFileName); break; case 'c': /* Config filename was set */ strlcpy(ConfigFileName, optarg, MAXBUF); - printf("CONFIG: Setting config file to %s\n", ConfigFileName); + if (owner_processid) + printf("CONFIG: Setting config file to %s\n", ConfigFileName); break; case 0: /* getopt_long_only() set an int variable, just keep going */ -- cgit v1.2.3