19 lines · plain
1.. title:: clang-tidy - android-cloexec-socket2 3android-cloexec-socket4======================5 6``socket()`` should include ``SOCK_CLOEXEC`` in its type argument to avoid the7file descriptor leakage. Without this flag, an opened sensitive file would8remain open across a fork+exec to a lower-privileged SELinux domain.9 10Examples:11 12.. code-block:: c++13 14 socket(domain, type, SOCK_STREAM);15 16 // becomes17 18 socket(domain, type, SOCK_STREAM | SOCK_CLOEXEC);19