fix(util/lean_path): warnings produced by Valgrind

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-12-23 10:02:48 -08:00
parent f0833b6f46
commit bcb41cd938

View file

@ -43,6 +43,7 @@ static std::string get_exe_location() {
// Linux version
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <sys/stat.h>
#include <limits.h> // NOLINT
#include <stdio.h>
@ -52,6 +53,7 @@ static char g_bad_sep = '\\';
static std::string get_exe_location() {
char path[PATH_MAX];
char dest[PATH_MAX];
memset(dest, 0, PATH_MAX);
pid_t pid = getpid();
snprintf(path, PATH_MAX, "/proc/%d/exe", pid);
if (readlink(path, dest, PATH_MAX) == -1) {