Bionic: Always use fortified versions of FD_X macros
When compiling on/for at least Lollipop, always use the fortified
versions of FD_X macros. This works around side-effect issues (which
are explicitly called out in the specification) and generally
increases robustness of code.
(cherry picked from commit 00a6d5fe0ab034e4d5e87636456cd49ef0ca5b8d)
Bug: 77986327
Test: mmma bionic
Test: m
Test: bionic_unit_tests
Merged-In: I9096c6872770e46ba5ab64e7375ff83fc0518e07
Change-Id: I9096c6872770e46ba5ab64e7375ff83fc0518e07
diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp
index 985d47f..c1340cb 100644
--- a/libc/bionic/fortify.cpp
+++ b/libc/bionic/fortify.cpp
@@ -80,17 +80,17 @@
int __FD_ISSET_chk(int fd, const fd_set* set, size_t set_size) {
__check_fd_set("FD_ISSET", fd, set_size);
- return FD_ISSET(fd, set);
+ return __FD_ISSET(fd, set);
}
void __FD_CLR_chk(int fd, fd_set* set, size_t set_size) {
__check_fd_set("FD_CLR", fd, set_size);
- FD_CLR(fd, set);
+ __FD_CLR(fd, set);
}
void __FD_SET_chk(int fd, fd_set* set, size_t set_size) {
__check_fd_set("FD_SET", fd, set_size);
- FD_SET(fd, set);
+ __FD_SET(fd, set);
}
char* __fgets_chk(char* dst, int supplied_size, FILE* stream, size_t dst_len_from_compiler) {