Bitcoin Core  0.19.99
P2P Digital Currency
glibc_sanity_fdelt.cpp
Go to the documentation of this file.
1 // Copyright (c) 2009-2019 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #if defined(HAVE_CONFIG_H)
7 #endif
8 
9 #if defined(HAVE_SYS_SELECT_H)
10 #ifdef HAVE_CSTRING_DEPENDENT_FD_ZERO
11 #include <cstring>
12 #endif
13 #include <sys/select.h>
14 
15 // trigger: Call FD_SET to trigger __fdelt_chk. FORTIFY_SOURCE must be defined
16 // as >0 and optimizations must be set to at least -O2.
17 // test: Add a file descriptor to an empty fd_set. Verify that it has been
18 // correctly added.
19 bool sanity_test_fdelt()
20 {
21  fd_set fds;
22  FD_ZERO(&fds);
23  FD_SET(0, &fds);
24  return FD_ISSET(0, &fds);
25 }
26 #endif