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
Loading
Please register or sign in to comment
