projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
058c251
)
Minor code simplification.
author
Dan Gohman
<gohman@apple.com>
Wed, 5 Aug 2009 20:16:55 +0000
(20:16 +0000)
committer
Dan Gohman
<gohman@apple.com>
Wed, 5 Aug 2009 20:16:55 +0000
(20:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78239
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/System/Unix/Path.inc
patch
|
blob
|
history
diff --git
a/lib/System/Unix/Path.inc
b/lib/System/Unix/Path.inc
index 822b0366baf06e36cfd10e06335eef441066a6d2..a54fcfd84bd47669b419e5a7faa0e9dc057115cc 100644
(file)
--- a/
lib/System/Unix/Path.inc
+++ b/
lib/System/Unix/Path.inc
@@
-344,10
+344,8
@@
Path Path::GetMainExecutable(const char *argv0, void *MainAddr) {
#elif defined(__linux__) || defined(__CYGWIN__)
char exe_path[MAXPATHLEN];
ssize_t len = readlink("/proc/self/exe", exe_path, sizeof(exe_path));
- if (len > 0 && len < MAXPATHLEN - 1) {
- exe_path[len] = '\0';
- return Path(std::string(exe_path));
- }
+ if (len >= 0)
+ return Path(std::string(exe_path, len));
#elif defined(HAVE_DLFCN_H)
// Use dladdr to get executable path if available.
Dl_info DLInfo;