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 | 815d45a2129244b0061bc8d59793c49f26df9f22 (patch) | |
tree | 522ec0afc081180fb45c5d6f1860d7b1c77921d1 /cpp/src/windows | |
parent | 5254145321df2be18fce790365d203b7342f48f5 (diff) | |
download | qpid-python-815d45a2129244b0061bc8d59793c49f26df9f22.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/qpid@793716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/windows')
-rw-r--r-- | cpp/src/windows/QpiddBroker.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cpp/src/windows/QpiddBroker.cpp b/cpp/src/windows/QpiddBroker.cpp index ed38475811..a22ccba63f 100644 --- a/cpp/src/windows/QpiddBroker.cpp +++ b/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") |