From a352d2473a8bf5d5cb711ea5ef1591604e2bef94 Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Thu, 2 Mar 2017 14:44:45 +0000 Subject: [PATCH] fd_utils: add missing logging for a couple of failure cases. Also start using libbase style logging. Other log statements will be converted in a follow up. Test: make Bug: 33579623 Change-Id: I34bb2ccab57e5bdd22aa35be8f8dcb68fdc4e097 --- core/jni/fd_utils.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp index 59a536b1b0016..5916020f8d7e1 100644 --- a/core/jni/fd_utils.cpp +++ b/core/jni/fd_utils.cpp @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -224,6 +225,7 @@ FileDescriptorInfo* FileDescriptorInfo::CreateFromFd(int fd) { bool FileDescriptorInfo::Restat() const { struct stat f_stat; if (TEMP_FAILURE_RETRY(fstat(fd, &f_stat)) == -1) { + PLOG(ERROR) << "Unable to restat fd " << fd; return false; } @@ -312,7 +314,10 @@ bool FileDescriptorInfo::Readlink(const int fd, std::string* result) { // ext2 and ext4 both have PAGE_SIZE limitations, so we assume that here. char buf[4096]; ssize_t len = readlink(path, buf, sizeof(buf)); - if (len == -1) return false; + if (len == -1) { + PLOG(ERROR) << "Readlink on " << fd << " failed."; + return false; + } result->assign(buf, len); return true;