From 3588c91253e8b6a1faf067c9e4b6068bfd25c035 Mon Sep 17 00:00:00 2001 From: Theodore Dubois Date: Wed, 27 Jul 2022 14:02:51 -0700 Subject: [PATCH] Log the errno if calling fork() fails Test: treehugger Change-Id: I9d54e3c2c006aaa54a5bc044e39ab5d5e2ff7484 --- core/jni/com_android_internal_os_Zygote.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index 3622029f118a0..789e5b0214a10 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -2127,6 +2127,8 @@ pid_t zygote::ForkCommon(JNIEnv* env, bool is_system_server, // Reset the fd to the unsolicited zygote socket gSystemServerSocketFd = -1; + } else if (pid == -1) { + ALOGE("Failed to fork child process: %s (%d)", strerror(errno), errno); } else { ALOGD("Forked child process %d", pid); }