[llvm] r345105 - Commit missing comment edit and use correct cast to fix std::min overload
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 23 16:44:44 PDT 2018
Author: rnk
Date: Tue Oct 23 16:44:44 2018
New Revision: 345105
URL: http://llvm.org/viewvc/llvm-project?rev=345105&view=rev
Log:
Commit missing comment edit and use correct cast to fix std::min overload
Modified:
llvm/trunk/lib/Support/Unix/Path.inc
Modified: llvm/trunk/lib/Support/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=345105&r1=345104&r2=345105&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Path.inc (original)
+++ llvm/trunk/lib/Support/Unix/Path.inc Tue Oct 23 16:44:44 2018
@@ -186,13 +186,13 @@ std::string getMainExecutable(const char
// Null terminate the string for realpath. readlink never null
// terminates its output.
- len = std::min(len, long(sizeof(exe_path) - 1));
+ len = std::min(len, ssize_t(sizeof(exe_path) - 1));
exe_path[len] = '\0';
- // At least on GNU/Hurd, /proc/self/exe is a symlink to the path that
- // was used to start the program, and not the eventual binary file.
- // We thus needs to run realpath over it to get the actual place
- // where llvm was installed.
+ // On Linux, /proc/self/exe always looks through symlinks. However, on
+ // GNU/Hurd, /proc/self/exe is a symlink to the path that was used to start
+ // the program, and not the eventual binary file. Therefore, call realpath
+ // so this behaves the same on all platforms.
#if _POSIX_VERSION >= 200112 || defined(__GLIBC__)
char *real_path = realpath(exe_path, NULL);
std::string ret = std::string(real_path);
More information about the llvm-commits
mailing list