diff options
author | Dan Gohman <gohman@apple.com> | 2009-08-05 20:16:55 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-08-05 20:16:55 +0000 |
commit | 798ae47b59cb33dd7780ee2d08c86362db60988c (patch) | |
tree | c4ce8385f33a12e778c88b4fbbb49e619f42c323 /llvm/lib/System/Unix/Path.inc | |
parent | ef98dbe3de31d6a77ebdcbbf58d181e13f9a8eb3 (diff) | |
download | bcm5719-llvm-798ae47b59cb33dd7780ee2d08c86362db60988c.tar.gz bcm5719-llvm-798ae47b59cb33dd7780ee2d08c86362db60988c.zip |
Minor code simplification.
llvm-svn: 78239
Diffstat (limited to 'llvm/lib/System/Unix/Path.inc')
-rw-r--r-- | llvm/lib/System/Unix/Path.inc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index 822b0366baf..a54fcfd84bd 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/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; |