Skip to content

Commit 7fb886b

Browse files
committed
[moveonly] Split glibc sanity_test_fdelt out
1 parent 66ce95a commit 7fb886b

File tree

3 files changed

+26
-17
lines changed

3 files changed

+26
-17
lines changed

src/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ libbitcoin_util_a_SOURCES = \
472472
support/lockedpool.cpp \
473473
chainparamsbase.cpp \
474474
clientversion.cpp \
475+
compat/glibc_sanity_fdelt.cpp \
475476
compat/glibc_sanity.cpp \
476477
compat/glibcxx_sanity.cpp \
477478
compat/strnlen.cpp \

src/compat/glibc_sanity.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2009-2018 The Bitcoin Core developers
1+
// Copyright (c) 2009-2019 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -9,7 +9,7 @@
99
#include <cstddef>
1010

1111
#if defined(HAVE_SYS_SELECT_H)
12-
#include <sys/select.h>
12+
bool sanity_test_fdelt();
1313
#endif
1414

1515
extern "C" void* memcpy(void* a, const void* b, size_t c);
@@ -41,21 +41,6 @@ bool sanity_test_memcpy()
4141
}
4242
return true;
4343
}
44-
45-
#if defined(HAVE_SYS_SELECT_H)
46-
// trigger: Call FD_SET to trigger __fdelt_chk. FORTIFY_SOURCE must be defined
47-
// as >0 and optimizations must be set to at least -O2.
48-
// test: Add a file descriptor to an empty fd_set. Verify that it has been
49-
// correctly added.
50-
bool sanity_test_fdelt()
51-
{
52-
fd_set fds;
53-
FD_ZERO(&fds);
54-
FD_SET(0, &fds);
55-
return FD_ISSET(0, &fds);
56-
}
57-
#endif
58-
5944
} // namespace
6045

6146
bool glibc_sanity_test()

src/compat/glibc_sanity_fdelt.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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)
6+
#include <config/bitcoin-config.h>
7+
#endif
8+
9+
#if defined(HAVE_SYS_SELECT_H)
10+
#include <sys/select.h>
11+
12+
// trigger: Call FD_SET to trigger __fdelt_chk. FORTIFY_SOURCE must be defined
13+
// as >0 and optimizations must be set to at least -O2.
14+
// test: Add a file descriptor to an empty fd_set. Verify that it has been
15+
// correctly added.
16+
bool sanity_test_fdelt()
17+
{
18+
fd_set fds;
19+
FD_ZERO(&fds);
20+
FD_SET(0, &fds);
21+
return FD_ISSET(0, &fds);
22+
}
23+
#endif

0 commit comments

Comments
 (0)