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

Skip to content
Commit a1703220 authored by Nick Kralevich's avatar Nick Kralevich
Browse files

liblog: fix fd leakage

File descriptors remain open across an exec unless FD_CLOEXEC is
set.  Add O_CLOEXEC to the open() call to prevent file descriptor
leakage.

In particular, the following program will eventually run out of
file descriptors:

int main(int argc, char **argv) {
  printf("===== entering main =====\n");
  ALOGW("entering main");
  system("ls -l /proc/self/fd/");

  execv(argv[0], argv);
  printf("exec failed\n");
  return -1;
}

Change-Id: I5be43ab3b9f82a05f242b1f586454c50568af388
parent 80dac350
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment