summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-10-23 23:44:44 +0000
committerReid Kleckner <rnk@google.com>2018-10-23 23:44:44 +0000
commit5fa1e35bcc99dbdeee4e966e21670f9d537c79f7 (patch)
treea292d08211bc9da01f0d1d887475857122427dce
parent1500effacda10eccbab15ea83779fd952564b411 (diff)
downloadbcm5719-llvm-5fa1e35bcc99dbdeee4e966e21670f9d537c79f7.tar.gz
bcm5719-llvm-5fa1e35bcc99dbdeee4e966e21670f9d537c79f7.zip
Commit missing comment edit and use correct cast to fix std::min overload
llvm-svn: 345105
-rw-r--r--llvm/lib/Support/Unix/Path.inc10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 8f98dda52d7..02b7c2579c9 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -186,13 +186,13 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
// 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);
OpenPOWER on IntegriCloud