From 33323a60d558ecad881db06123f4eb0dfba37fc9 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 11 Jul 2014 19:10:15 -0400
Subject: [PATCH] P4 to Git Change 1054614 by marsenau@marsenau_home on
2014/07/11 19:01:37
ECR #304775 - Fix valgrind use of uninitialized errors, modernize by using unique_ptr, and use existing function to extract filename from path.
Should probably also fix the static constructors this is called from.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#37 edit
[ROCm/clr commit: a901b12dd1de2de083c9ad07966acd92f58fad8f]
---
projects/clr/rocclr/runtime/os/os_posix.cpp | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/projects/clr/rocclr/runtime/os/os_posix.cpp b/projects/clr/rocclr/runtime/os/os_posix.cpp
index 6c0b5b069e..dfe2dd4394 100644
--- a/projects/clr/rocclr/runtime/os/os_posix.cpp
+++ b/projects/clr/rocclr/runtime/os/os_posix.cpp
@@ -39,6 +39,7 @@
#include
#include // for tempnam
#include
+#include
@@ -91,7 +92,7 @@ divisionErrorHandler(int sig, siginfo_t* info, void* ptr)
#if defined(ATI_ARCH_X86)
insn = (address)uc->uc_mcontext.gregs[LP64_SWITCH(REG_EIP,REG_RIP)];
#else
- assert(!"Unimplemented");
+ assert(!"Unimplemented");
#endif
// Call the chained signal handler
@@ -110,7 +111,7 @@ divisionErrorHandler(int sig, siginfo_t* info, void* ptr)
#if defined(ATI_ARCH_X86)
uc->uc_mcontext.gregs[LP64_SWITCH(REG_EIP,REG_RIP)] = (greg_t)insn;
#else
- assert(!"Unimplemented");
+ assert(!"Unimplemented");
#endif
return;
}
@@ -865,16 +866,14 @@ size_t Os::getPhysicalMemSize()
std::string Os::getAppFileName()
{
- std::string strFileName;
- char* buff = new char[FILE_PATH_MAX_LENGTH];
+ std::unique_ptr buff(new char[FILE_PATH_MAX_LENGTH]());
- if (readlink("/proc/self/exe", buff, FILE_PATH_MAX_LENGTH) > 0) {
+ if (readlink("/proc/self/exe", buff.get(), FILE_PATH_MAX_LENGTH) > 0) {
// Get filename without path and extension.
- strFileName = strrchr(buff, '/') ? strrchr(buff, '/') + 1 : buff;
+ return std::string(basename(buff.get()));
}
- delete buff;
- return strFileName;
+ return "";
}
} // namespace amd