summaryrefslogtreecommitdiff
path: root/libs/androidfw/CursorWindow.cpp
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2019-01-14 14:03:36 -0800
committerNick Kralevich <nnk@google.com>2019-01-14 14:05:06 -0800
commite104df94836ebf34d7f1a8654a9795b0a7619fda (patch)
treecdaa4fb58f042672a71217e51aa65b5cfd025b68 /libs/androidfw/CursorWindow.cpp
parent7ae295368dbb3d9b4dfa67231416cfde2bcdadb0 (diff)
CursorWindow.cpp: replace dup() with fcntl(F_DUPFD_CLOEXEC)
Replace calls to dup() with fcntl(F_DUPFD_CLOEXEC). The only difference between the two is that O_CLOEXEC is set on the newly duped file descriptor. This helps address file descriptor leaks crossing an exec() boundary. Test: compiles and boots Bug: 120983106 Change-Id: Icc2ff2f7f398905aa8283c8797898114d34a9829
Diffstat (limited to 'libs/androidfw/CursorWindow.cpp')
-rw-r--r--libs/androidfw/CursorWindow.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/androidfw/CursorWindow.cpp b/libs/androidfw/CursorWindow.cpp
index 5694115f61aa..a99e77f8dbb9 100644
--- a/libs/androidfw/CursorWindow.cpp
+++ b/libs/androidfw/CursorWindow.cpp
@@ -94,7 +94,7 @@ status_t CursorWindow::createFromParcel(Parcel* parcel, CursorWindow** outCursor
if (size < 0) {
result = UNKNOWN_ERROR;
} else {
- int dupAshmemFd = ::dup(ashmemFd);
+ int dupAshmemFd = ::fcntl(ashmemFd, F_DUPFD_CLOEXEC, 0);
if (dupAshmemFd < 0) {
result = -errno;
} else {