Some CLOEXEC love.

Bug: 19993667
Change-Id: If8c0b346820f30c6a7dac495f935be17d677ffcc
This commit is contained in:
Jeff Sharkey 2015-04-01 23:07:19 -07:00
parent 95c87cce35
commit f7e86ead9f

View file

@ -33,6 +33,7 @@
#include "cutils/klog.h"
#include "cutils/log.h"
#include "cutils/properties.h"
#include "cutils/sockets.h"
#include "Disk.h"
#include "VolumeManager.h"
@ -71,6 +72,9 @@ int main(int argc, char** argv) {
selinux_android_set_sehandle(sehandle);
}
// Quickly throw a CLOEXEC on the socket we just inherited from init
fcntl(android_get_control_socket("vold"), F_SETFD, FD_CLOEXEC);
mkdir("/dev/block/vold", 0755);
/* For when cryptfs checks and mounts an encrypted filesystem */
@ -155,7 +159,7 @@ static void do_coldboot(DIR *d, int lvl) {
dfd = dirfd(d);
fd = openat(dfd, "uevent", O_WRONLY);
fd = openat(dfd, "uevent", O_WRONLY | O_CLOEXEC);
if(fd >= 0) {
write(fd, "add\n", 4);
close(fd);