From b6182b3080be69f7983ad6ff8e3d23ecabf4d266 Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Tue, 16 May 2017 22:06:42 +0000 Subject: [PATCH] Revert "Newly create idmap only when it is outdated" This reverts commit 1d091465334784adeded4ef182cc6f732eb6f99e. Reason for revert: Causes b/37992057 Change-Id: I7811483016b28a88d6a50bd445dd5d5e8d2e48d6 --- cmds/installd/InstalldNativeService.cpp | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp index bdf69b941d..989fcdaea6 100644 --- a/cmds/installd/InstalldNativeService.cpp +++ b/cmds/installd/InstalldNativeService.cpp @@ -1961,8 +1961,6 @@ binder::Status InstalldNativeService::idmap(const std::string& targetApkPath, int idmap_fd = -1; char idmap_path[PATH_MAX]; - struct stat target_apk_stat, overlay_apk_stat, idmap_stat; - bool outdated = false; if (flatten_path(IDMAP_PREFIX, IDMAP_SUFFIX, overlay_apk, idmap_path, sizeof(idmap_path)) == -1) { @@ -1970,22 +1968,8 @@ binder::Status InstalldNativeService::idmap(const std::string& targetApkPath, goto fail; } - if (stat(idmap_path, &idmap_stat) < 0 || - stat(target_apk, &target_apk_stat) < 0 || - stat(overlay_apk, &overlay_apk_stat) < 0) { - outdated = true; - } else if (idmap_stat.st_mtime < target_apk_stat.st_mtime || - idmap_stat.st_mtime < overlay_apk_stat.st_mtime) { - outdated = true; - } - - if (outdated) { - unlink(idmap_path); - idmap_fd = open(idmap_path, O_RDWR | O_CREAT | O_EXCL, 0644); - } else { - idmap_fd = open(idmap_path, O_RDWR); - } - + unlink(idmap_path); + idmap_fd = open(idmap_path, O_RDWR | O_CREAT | O_EXCL, 0644); if (idmap_fd < 0) { ALOGE("idmap cannot open '%s' for output: %s\n", idmap_path, strerror(errno)); goto fail; @@ -1999,11 +1983,6 @@ binder::Status InstalldNativeService::idmap(const std::string& targetApkPath, goto fail; } - if (!outdated) { - close(idmap_fd); - return ok(); - } - pid_t pid; pid = fork(); if (pid == 0) { -- 2.11.0