From b549243b2716c293d0a1be45fe28088b0150789d Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Wed, 16 Jan 2019 09:29:17 -0800 Subject: Use O_CLOEXEC at a few places. Found these FDs unintentionally propagated into forked processes (e.g. updater) during my local debugging. Use O_CLOEXEC to avoid that. Test: Dump open FDs in updater process. Test: Sideload a package on taimen (which uses framebuffer). Test: Run graphics test on taimen. Change-Id: I1fb65dd4a103c47d28b15973def9e9359c251ca3 --- minui/graphics_drm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'minui/graphics_drm.cpp') diff --git a/minui/graphics_drm.cpp b/minui/graphics_drm.cpp index 765e2625a..7b2eed15d 100644 --- a/minui/graphics_drm.cpp +++ b/minui/graphics_drm.cpp @@ -285,7 +285,7 @@ GRSurface* MinuiBackendDrm::Init() { /* Consider DRM devices in order. */ for (int i = 0; i < DRM_MAX_MINOR; i++) { auto dev_name = android::base::StringPrintf(DRM_DEV_NAME, DRM_DIR_NAME, i); - android::base::unique_fd fd(open(dev_name.c_str(), O_RDWR)); + android::base::unique_fd fd(open(dev_name.c_str(), O_RDWR | O_CLOEXEC)); if (fd == -1) continue; /* We need dumb buffers. */ -- cgit v1.2.3