[llvm-commits] [llvm] r78239 - /llvm/trunk/lib/System/Unix/Path.inc
Dan Gohman
gohman at apple.com
Wed Aug 5 13:16:58 PDT 2009
Author: djg
Date: Wed Aug 5 15:16:55 2009
New Revision: 78239
URL: http://llvm.org/viewvc/llvm-project?rev=78239&view=rev
Log:
Minor code simplification.
Modified:
llvm/trunk/lib/System/Unix/Path.inc
Modified: llvm/trunk/lib/System/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=78239&r1=78238&r2=78239&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Path.inc (original)
+++ llvm/trunk/lib/System/Unix/Path.inc Wed Aug 5 15:16:55 2009
@@ -344,10 +344,8 @@
#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;
More information about the llvm-commits
mailing list