aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-04-04 17:07:24 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2023-04-04 17:07:24 +0000
commit30072cdaa3603f953d35ed4591394b8c10ff7137 (patch)
treea4cb7a9734edf286bbf40991f590b94a15b74db1
parentb21c24b6fa417f9940038180b23fe98b3e5d2acb (diff)
parent03d367cc45a4d2e8c430d6abd1e7da2266c280ad (diff)
downloadqemu-snap-temp-L89000000959684617.tar.gz
Merge "Merge cherrypicks of ['android-review.googlesource.com/2520876'] into emu-32-release." into emu-32-releasesnap-temp-L89000000959684617snap-temp-L29900000959682055
-rwxr-xr-xandroid/android-emu-base/android/base/system/System.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/android/android-emu-base/android/base/system/System.cpp b/android/android-emu-base/android/base/system/System.cpp
index 73bf1b9b28..123920636a 100755
--- a/android/android-emu-base/android/base/system/System.cpp
+++ b/android/android-emu-base/android/base/system/System.cpp
@@ -1723,6 +1723,17 @@ public:
close(fd);
}
+#ifndef _WIN32
+ // b/267354112
+ // need to close all the fds (other than stdio/... ) inherited from parent
+ if ((options & RunOptions::WaitForCompletion) == 0) {
+ int fdlimit = (int)sysconf(_SC_OPEN_MAX);
+ for (int i = STDERR_FILENO + 1; i < fdlimit; i++) {
+ close(i);
+ }
+ }
+#endif
+
if (execvp(command, params.data()) == -1) {
// emulator doesn't really like exit calls from a forked process
// (it just hangs), so let's just kill it