diff options
author | Stephen D. Huston <shuston@apache.org> | 2009-07-13 21:27:14 +0000 |
---|---|---|
committer | Stephen D. Huston <shuston@apache.org> | 2009-07-13 21:27:14 +0000 |
commit | f05c689c4e638078bdd47d3b890b3db53db8dec4 (patch) | |
tree | f93bcd0a9f631313a63dacaf11fc910549337a04 /qpid/cpp/src/windows/QpiddBroker.cpp | |
parent | d30c7f570fb20a3d59af800523453bfd48a2f257 (diff) | |
download | qpid-python-f05c689c4e638078bdd47d3b890b3db53db8dec4.tar.gz |
Replace getenv usage with more secure Windows calls - silences compile diagnostics. This involved adding a new method Broker::Options::getHome() implemented separately for Windows and posix BrokerDefaults.cpp
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@793716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/windows/QpiddBroker.cpp')
-rw-r--r-- | qpid/cpp/src/windows/QpiddBroker.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/qpid/cpp/src/windows/QpiddBroker.cpp b/qpid/cpp/src/windows/QpiddBroker.cpp index ed38475811..a22ccba63f 100644 --- a/qpid/cpp/src/windows/QpiddBroker.cpp +++ b/qpid/cpp/src/windows/QpiddBroker.cpp @@ -39,6 +39,7 @@ const char *QPIDD_MODULE_DIR = "."; #include "qpid/broker/Broker.h" #include <iostream> +#include <windows.h> using namespace qpid::broker; @@ -145,16 +146,16 @@ struct ProcessControlOptions : public qpid::Options { quit(false), check(false) //, transport(TCP) { - char *tempDir = ::getenv("TEMP"); - - if (tempDir == 0) - piddir = "C:\\WINDOWS\\TEMP"; + const DWORD pathLen = MAX_PATH + 1; + char tempDir[pathLen]; + if (GetTempPath(pathLen, tempDir) == 0) + piddir = "C:\\WINDOWS\\TEMP\\"; else piddir = tempDir; - piddir += "\\qpidd"; + piddir += "qpidd"; // Only have TCP for now, so don't need this... - // ("transport", optValue(transport, "TRANSPORT"), "The transport for which to return the port") + // ("transport", optValue(transport, "TRANSPORT"), "The transport for which to return the port") addOptions() ("pid-dir", qpid::optValue(piddir, "DIR"), "Directory where port-specific PID file is stored") ("check,c", qpid::optValue(check), "Prints the broker's process ID to stdout and returns 0 if the broker is running, otherwise returns 1") |