Author: shuston Date: Tue Jul 21 23:37:24 2009 New Revision: 796581 URL: http://svn.apache.org/viewvc?rev=796581&view=rev Log: Never try to init a string with a zero pointer; fixes QPID-1998
Modified: qpid/trunk/qpid/cpp/src/qpid/sys/windows/SystemInfo.cpp Modified: qpid/trunk/qpid/cpp/src/qpid/sys/windows/SystemInfo.cpp URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/sys/windows/SystemInfo.cpp?rev=796581&r1=796580&r2=796581&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/src/qpid/sys/windows/SystemInfo.cpp (original) +++ qpid/trunk/qpid/cpp/src/qpid/sys/windows/SystemInfo.cpp Tue Jul 21 23:37:24 2009 @@ -181,18 +181,21 @@ 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 --------------------------------------------------------------------- Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:commits-subscr...@qpid.apache.org