diff options
Diffstat (limited to 'src/client/linux/minidump_writer/linux_dumper_unittest.cc')
-rw-r--r-- | src/client/linux/minidump_writer/linux_dumper_unittest.cc | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/client/linux/minidump_writer/linux_dumper_unittest.cc b/src/client/linux/minidump_writer/linux_dumper_unittest.cc index 1eee9a18..6f4e0e44 100644 --- a/src/client/linux/minidump_writer/linux_dumper_unittest.cc +++ b/src/client/linux/minidump_writer/linux_dumper_unittest.cc @@ -43,6 +43,7 @@ #include "client/linux/minidump_writer/linux_dumper.h" #include "common/linux/eintr_wrapper.h" #include "common/linux/file_id.h" +#include "common/linux/safe_readlink.h" #include "common/memory.h" using std::string; @@ -54,7 +55,7 @@ typedef testing::Test LinuxDumperTest; string GetHelperBinary() { // Locate helper binary next to the current binary. char self_path[PATH_MAX]; - if (readlink("/proc/self/exe", self_path, sizeof(self_path) - 1) == -1) { + if (!SafeReadLink("/proc/self/exe", self_path)) { return ""; } string helper_path(self_path); @@ -379,9 +380,7 @@ TEST(LinuxDumperTest, FileIDsMatch) { // FileID::ElfFileIdentifier and LinuxDumper::ElfFileIdentifierForMapping // and ensure that we get the same result from both. char exe_name[PATH_MAX]; - ssize_t len = readlink("/proc/self/exe", exe_name, PATH_MAX - 1); - ASSERT_NE(len, -1); - exe_name[len] = '\0'; + ASSERT_TRUE(SafeReadLink("/proc/self/exe", exe_name)); int fds[2]; ASSERT_NE(-1, pipe(fds)); |