Skip to content

Commit 89875a4

Browse files
committed
tests/open_wrapper: Only mess with glibc internals when building against glibc
1 parent 7ce2002 commit 89875a4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/mir_test_framework/open_wrapper.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
* These runes are taken from the Ubuntu umockdev patch solving the same
2828
* problem there.
2929
*/
30+
#ifdef __GLIBC__ /* This is messing with glibc internals, and is not
31+
* expected to work (or be needed) anywhere else.
32+
* (Hello, musl!)
33+
*/
3034
/* Remove gcc asm aliasing so that our interposed symbols work as expected */
3135
#include <sys/cdefs.h>
3236

@@ -44,6 +48,7 @@ extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf,
4448
#undef __REDIRECT_NTH
4549
#endif
4650
#define __REDIRECT_NTH(name, proto, alias) name proto __THROW
51+
#endif // __GLIBC__
4752
/*
4853
* End glibc hackery (although there is a second block below)
4954
*/
@@ -63,13 +68,15 @@ extern int __REDIRECT_NTH (__ttyname_r_alias, (int __fd, char *__buf,
6368
*
6469
* Fixup for making a mess with __REDIRECT above
6570
*/
71+
#ifdef __GLIBC__
6672
#ifdef __USE_TIME_BITS64
6773
#define clock_gettime __clock_gettime64
6874
extern "C"
6975
{
7076
extern int clock_gettime(clockid_t clockid, struct timespec *tp);
7177
}
7278
#endif
79+
#endif // __GLIBC__
7380
/*
7481
* End glibc hackery
7582
*/

0 commit comments

Comments
 (0)