Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38898882 authored by Nick Kralevich's avatar Nick Kralevich
Browse files

set O_CLOEXEC on /dev/tun open

Ensure that this file descriptor cannot leak across exec boundaries, in
the unlikely event that system_server does an exec().

Test: device boots and no problems.
Change-Id: I45691b7780026ea288e57db73fcc88820a2b06b1
parent f5852d15
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ static inline in_addr_t *as_in_addr(sockaddr *sa) {

static int create_interface(int mtu)
{
    int tun = open("/dev/tun", O_RDWR | O_NONBLOCK);
    int tun = open("/dev/tun", O_RDWR | O_NONBLOCK | O_CLOEXEC);

    ifreq ifr4;
    memset(&ifr4, 0, sizeof(ifr4));