summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2009-07-21 23:37:24 +0000
committerStephen D. Huston <shuston@apache.org>2009-07-21 23:37:24 +0000
commit9fd39f8c5150620c2e534fc32a4aa2c09c5c9abc (patch)
tree5dddd615ca05c1b7620c90b83d7c19d228399d62 /cpp/src
parent78d8c3ed5193fd633e32fdefe804c45c239fafeb (diff)
downloadqpid-python-9fd39f8c5150620c2e534fc32a4aa2c09c5c9abc.tar.gz
Never try to init a string with a zero pointer; fixes QPID-1998
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@796581 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rwxr-xr-xcpp/src/qpid/sys/windows/SystemInfo.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/cpp/src/qpid/sys/windows/SystemInfo.cpp b/cpp/src/qpid/sys/windows/SystemInfo.cpp
index 3e2fcb1517..ea53fc199c 100755
--- a/cpp/src/qpid/sys/windows/SystemInfo.cpp
+++ b/cpp/src/qpid/sys/windows/SystemInfo.cpp
@@ -181,18 +181,21 @@ uint32_t SystemInfo::getParentProcessId()
std::string SystemInfo::getProcessName()
{
+ std::string name;
+
// Only want info for the current process, so ask for something specific.
// The module info won't be used here but it keeps the snapshot limited to
// the current process so a search through all processes is not needed.
HANDLE snap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0);
if (snap == INVALID_HANDLE_VALUE)
- return 0;
+ return name;
PROCESSENTRY32 entry;
entry.dwSize = sizeof(entry);
if (!Process32First(snap, &entry))
entry.szExeFile[0] = '\0';
CloseHandle(snap);
- return std::string(entry.szExeFile);
+ name = entry.szExeFile;
+ return name;
}
}} // namespace qpid::sys