mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-23 07:15:29 +01:00
[moveonly] Split glibc sanity_test_fdelt out
This commit is contained in:
parent
66ce95a434
commit
7fb886b1b1
3 changed files with 26 additions and 17 deletions
|
@ -472,6 +472,7 @@ libbitcoin_util_a_SOURCES = \
|
||||||
support/lockedpool.cpp \
|
support/lockedpool.cpp \
|
||||||
chainparamsbase.cpp \
|
chainparamsbase.cpp \
|
||||||
clientversion.cpp \
|
clientversion.cpp \
|
||||||
|
compat/glibc_sanity_fdelt.cpp \
|
||||||
compat/glibc_sanity.cpp \
|
compat/glibc_sanity.cpp \
|
||||||
compat/glibcxx_sanity.cpp \
|
compat/glibcxx_sanity.cpp \
|
||||||
compat/strnlen.cpp \
|
compat/strnlen.cpp \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2009-2018 The Bitcoin Core developers
|
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#if defined(HAVE_SYS_SELECT_H)
|
#if defined(HAVE_SYS_SELECT_H)
|
||||||
#include <sys/select.h>
|
bool sanity_test_fdelt();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern "C" void* memcpy(void* a, const void* b, size_t c);
|
extern "C" void* memcpy(void* a, const void* b, size_t c);
|
||||||
|
@ -41,21 +41,6 @@ bool sanity_test_memcpy()
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_SYS_SELECT_H)
|
|
||||||
// trigger: Call FD_SET to trigger __fdelt_chk. FORTIFY_SOURCE must be defined
|
|
||||||
// as >0 and optimizations must be set to at least -O2.
|
|
||||||
// test: Add a file descriptor to an empty fd_set. Verify that it has been
|
|
||||||
// correctly added.
|
|
||||||
bool sanity_test_fdelt()
|
|
||||||
{
|
|
||||||
fd_set fds;
|
|
||||||
FD_ZERO(&fds);
|
|
||||||
FD_SET(0, &fds);
|
|
||||||
return FD_ISSET(0, &fds);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
bool glibc_sanity_test()
|
bool glibc_sanity_test()
|
||||||
|
|
23
src/compat/glibc_sanity_fdelt.cpp
Normal file
23
src/compat/glibc_sanity_fdelt.cpp
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (c) 2009-2019 The Bitcoin Core developers
|
||||||
|
// Distributed under the MIT software license, see the accompanying
|
||||||
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#if defined(HAVE_CONFIG_H)
|
||||||
|
#include <config/bitcoin-config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_SYS_SELECT_H)
|
||||||
|
#include <sys/select.h>
|
||||||
|
|
||||||
|
// trigger: Call FD_SET to trigger __fdelt_chk. FORTIFY_SOURCE must be defined
|
||||||
|
// as >0 and optimizations must be set to at least -O2.
|
||||||
|
// test: Add a file descriptor to an empty fd_set. Verify that it has been
|
||||||
|
// correctly added.
|
||||||
|
bool sanity_test_fdelt()
|
||||||
|
{
|
||||||
|
fd_set fds;
|
||||||
|
FD_ZERO(&fds);
|
||||||
|
FD_SET(0, &fds);
|
||||||
|
return FD_ISSET(0, &fds);
|
||||||
|
}
|
||||||
|
#endif
|
Loading…
Add table
Reference in a new issue