Do not return an error if the dalvik-cache odex is missing
Test: adb shell /data/nativetest/installd_service_test/installd_service_test
Tried uninstalling an updated version of prebuilt app.
Didn't find the error message in the logcat.
Bug: 35804241
Change-Id: Iec045fa9c9ac8f036785fe5cbd0f7e43f2b680c1
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 49a3b23..25dbe98 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -1089,10 +1089,13 @@
ALOGV("unlink %s\n", dex_path);
if (unlink(dex_path) < 0) {
- return error(StringPrintf("Failed to unlink %s", dex_path));
- } else {
- return ok();
+ // It's ok if we don't have a dalvik cache path. Report error only when the path exists
+ // but could not be unlinked.
+ if (errno != ENOENT) {
+ return error(StringPrintf("Failed to unlink %s", dex_path));
+ }
}
+ return ok();
}
struct stats {