Merge "libcutils: fallback to /dev/ashmem" am: 6e016ef80e am: 0714a9eae2 am: 315d44f02c

Change-Id: I334c8988af63a49dab7ace5045b9a792eb0050b2
This commit is contained in:
Automerger Merge Worker 2020-01-15 20:17:28 +00:00
commit 3f963835ff

View file

@ -203,19 +203,23 @@ static int __ashmem_open_locked()
{
static const std::string ashmem_device_path = get_ashmem_device_path();
int ret;
struct stat st;
if (ashmem_device_path.empty()) {
return -1;
}
int fd = TEMP_FAILURE_RETRY(open(ashmem_device_path.c_str(), O_RDWR | O_CLOEXEC));
// fallback for APEX w/ use_vendor on Q, which would have still used /dev/ashmem
if (fd < 0) {
fd = TEMP_FAILURE_RETRY(open("/dev/ashmem", O_RDWR | O_CLOEXEC));
}
if (fd < 0) {
return fd;
}
ret = TEMP_FAILURE_RETRY(fstat(fd, &st));
struct stat st;
int ret = TEMP_FAILURE_RETRY(fstat(fd, &st));
if (ret < 0) {
int save_errno = errno;
close(fd);