[compiler-rt] compiler-rt: sanitizer_common: use close_range() instead of looping (PR #114442)
Jessica Clarke via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 11:29:42 PDT 2024
================
@@ -543,7 +543,11 @@ pid_t StartSubprocess(const char *program, const char *const argv[],
internal_close(stderr_fd);
}
+# if SANITIZER_FREEBSD
+ internal_close_range(3, ~0U, 0);
----------------
jrtc27 wrote:
fd_t is a (signed) int, so ~0U is odd. Moreover, if you wanted to be generic across whatever integral type fd_t happens to be, ~0U will zero-extend to wider integers, regardless of the wider integer's type, and ~0 will sign-extend, regardless of the wider type. Or you can do `~(fd_t)0` if you want to be explicit and not have to think about integer conversion rules.
https://github.com/llvm/llvm-project/pull/114442
More information about the llvm-commits
mailing list