summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2015-05-08 12:13:51 -0700
committerNick Kralevich <nnk@google.com>2015-05-08 12:39:25 -0700
commit44e832111643307772fa3dcbc521d1acd4e8ae7d (patch)
tree887deaead8aac3048621f9d913bc86f33395eb79
parent85bff332cc3b8ba33e66246052647ca1a546dc42 (diff)
downloadhardware_libhardware_legacy-44e832111643307772fa3dcbc521d1acd4e8ae7d.zip
hardware_libhardware_legacy-44e832111643307772fa3dcbc521d1acd4e8ae7d.tar.gz
hardware_libhardware_legacy-44e832111643307772fa3dcbc521d1acd4e8ae7d.tar.bz2
power.c: add O_CLOEXEC on wakelocks
Ensure that FDs associated with /sys/power/wake_lock and /sys/power/wake_unlock are closed on exec. (cherrypicked from b3624b26b2a55f33326c794565dd07d5078c655c) Change-Id: Ia2c8937cf6a1fdd6564fad4785642934c805cf22
-rw-r--r--power/power.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/power/power.c b/power/power.c
index a90cc6b..e0eda2d 100644
--- a/power/power.c
+++ b/power/power.c
@@ -64,7 +64,7 @@ open_file_descriptors(const char * const paths[])
{
int i;
for (i=0; i<OUR_FD_COUNT; i++) {
- int fd = open(paths[i], O_RDWR);
+ int fd = open(paths[i], O_RDWR | O_CLOEXEC);
if (fd < 0) {
fprintf(stderr, "fatal error opening \"%s\"\n", paths[i]);
g_error = errno;