Skip to content

Commit

Permalink
avoid AssetManager errors with exec spawning
Browse files Browse the repository at this point in the history
This causes harmless errors and wastes time spawning a process that's
not going to succeed.
  • Loading branch information
thestinger committed Aug 25, 2019
1 parent 01a01ce commit 17c309c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/jni/android_util_AssetManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 17c309c

Please sign in to comment.