Loading core/jni/fd_utils.cpp +6 −1 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <sys/un.h> #include <sys/un.h> #include <unistd.h> #include <unistd.h> #include <android-base/logging.h> #include <android-base/strings.h> #include <android-base/strings.h> #include <cutils/log.h> #include <cutils/log.h> Loading Loading @@ -224,6 +225,7 @@ FileDescriptorInfo* FileDescriptorInfo::CreateFromFd(int fd) { bool FileDescriptorInfo::Restat() const { bool FileDescriptorInfo::Restat() const { struct stat f_stat; struct stat f_stat; if (TEMP_FAILURE_RETRY(fstat(fd, &f_stat)) == -1) { if (TEMP_FAILURE_RETRY(fstat(fd, &f_stat)) == -1) { PLOG(ERROR) << "Unable to restat fd " << fd; return false; return false; } } Loading Loading @@ -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. // ext2 and ext4 both have PAGE_SIZE limitations, so we assume that here. char buf[4096]; char buf[4096]; ssize_t len = readlink(path, buf, sizeof(buf)); 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); result->assign(buf, len); return true; return true; Loading Loading
core/jni/fd_utils.cpp +6 −1 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include <sys/un.h> #include <sys/un.h> #include <unistd.h> #include <unistd.h> #include <android-base/logging.h> #include <android-base/strings.h> #include <android-base/strings.h> #include <cutils/log.h> #include <cutils/log.h> Loading Loading @@ -224,6 +225,7 @@ FileDescriptorInfo* FileDescriptorInfo::CreateFromFd(int fd) { bool FileDescriptorInfo::Restat() const { bool FileDescriptorInfo::Restat() const { struct stat f_stat; struct stat f_stat; if (TEMP_FAILURE_RETRY(fstat(fd, &f_stat)) == -1) { if (TEMP_FAILURE_RETRY(fstat(fd, &f_stat)) == -1) { PLOG(ERROR) << "Unable to restat fd " << fd; return false; return false; } } Loading Loading @@ -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. // ext2 and ext4 both have PAGE_SIZE limitations, so we assume that here. char buf[4096]; char buf[4096]; ssize_t len = readlink(path, buf, sizeof(buf)); 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); result->assign(buf, len); return true; return true; Loading