commit | a1703220834ddeffde5d571cd776ca981e8a42f6 | [log] [tgz] |
---|---|---|
author | Nick Kralevich <nnk@google.com> | Fri Mar 15 09:45:12 2013 -0700 |
committer | Nick Kralevich <nnk@google.com> | Fri Mar 15 09:48:32 2013 -0700 |
tree | a87f3e5ca1d4f7cc1c3680ef9f1097582b16a0df | |
parent | 80dac35023bb7860b7382ca995e19710bd894e7e [diff] |
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