Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang-tidy android-cloexec-fopen docs should say if e is safe across platforms #123492

Open
seanm opened this issue Jan 19, 2025 · 1 comment
Open

Comments

@seanm
Copy link

seanm commented Jan 19, 2025

The docs for android-cloexec-fopen here:

https://clang.llvm.org/extra/clang-tidy/checks/android/cloexec-fopen.html

say only "fopen() should include e in their mode string; so re would be valid. This is equivalent to having set FD_CLOEXEC on that descriptor."

By having "android" in the check's name, one assumes this works on Android.

The macOS 10.13 through 15.3 man pages say e is supported.

Not sure about Windows, linux, the BSDs, or others.

But most important of all: is it known that adding e would be harmless/ignored on all OSes? If it's not knowm, it's risky to just add an e in cross-platform code, because maybe the e would break some implementations of fopen.

@llvmbot
Copy link
Member

llvmbot commented Jan 19, 2025

@llvm/issue-subscribers-clang-tidy

Author: Sean McBride (seanm)

The docs for `android-cloexec-fopen` here:

https://clang.llvm.org/extra/clang-tidy/checks/android/cloexec-fopen.html

say only "fopen() should include e in their mode string; so re would be valid. This is equivalent to having set FD_CLOEXEC on that descriptor."

By having "android" in the check's name, one assumes this works on Android.

The macOS 10.13 through 15.3 man pages say e is supported.

Not sure about Windows, linux, the BSDs, or others.

But most important of all: is it known that adding e would be harmless/ignored on all OSes? If it's not knowm, it's risky to just add an e in cross-platform code, because maybe the e would break some implementations of fopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants