DivestOS/Patches/LineageOS-16.0/android_frameworks_base/0010-Exec_Based_Spawning-9.patch
Tad 987122f99e Churn
Signed-off-by: Tad <tad@spotco.us>
2022-04-01 02:12:34 -04:00

27 lines
1.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Micay <danielmicay@gmail.com>
Date: Tue, 14 May 2019 15:11:59 -0400
Subject: [PATCH] avoid AssetManager errors with exec spawning
This causes harmless errors and wastes time spawning a process that's
not going to succeed.
---
core/jni/android_util_AssetManager.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index fa9f44557d3f..08060163017f 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -111,6 +111,10 @@ constexpr inline static ApkAssetsCookie JavaCookieToApkAssetsCookie(jint cookie)
// This is called by zygote (running as user root) as part of preloadResources.
static void NativeVerifySystemIdmaps(JNIEnv* /*env*/, jclass /*clazz*/) {
+ // avoid triggering an error with exec-based spawning
+ if (getuid() != 0) {
+ return;
+ }
switch (pid_t pid = fork()) {
case -1:
PLOG(ERROR) << "failed to fork for idmap";