diff --git a/tests/ipc_sock.test b/tests/ipc_sock.test index 39b5c074..ac6d69be 100755 --- a/tests/ipc_sock.test +++ b/tests/ipc_sock.test @@ -7,7 +7,7 @@ # if [ "`uname -s`" = "Linux" ] then - if [ -f `pwd`/.libs/libstatwrapper.so ] + if [ -f `pwd`/.libs/libstat_wrapper.so ] then export LD_PRELOAD=`pwd`/.libs/libstat_wrapper.so else diff --git a/tests/libstat_wrapper.c b/tests/libstat_wrapper.c index 09fba969..a76488a6 100644 --- a/tests/libstat_wrapper.c +++ b/tests/libstat_wrapper.c @@ -11,6 +11,7 @@ #include #endif +// __xstat for ealier libc int __xstat(int __ver, const char *__filename, struct stat *__stat_buf) { #if defined(QB_LINUX) || defined(QB_CYGWIN) @@ -25,6 +26,7 @@ int __xstat(int __ver, const char *__filename, struct stat *__stat_buf) } if (strcmp(__filename, FORCESOCKETSFILE) == 0) { + fprintf(stderr, "__xstat called for %s\n", __filename); return 0; /* it exists! */ } @@ -33,3 +35,28 @@ int __xstat(int __ver, const char *__filename, struct stat *__stat_buf) return -1; /* Error in the unlikely event we get called on *BSD* */ #endif } + +// Stat for F35 and later +int stat(const char *__filename, struct stat *__stat_buf) +{ +#if defined(QB_LINUX) || defined(QB_CYGWIN) + static int opened = 0; + static void *dlhandle; + static int (*real_stat)(const char *__filename, void *__stat_buf); + + if (!opened) { + dlhandle = dlopen(LIBC_SO, RTLD_NOW); + real_stat = dlsym(dlhandle, "stat"); + opened = 1; + } + + if (strcmp(__filename, FORCESOCKETSFILE) == 0) { + fprintf(stderr, "stat called for %s\n", __filename); + return 0; /* it exists! */ + } + + return real_stat(__filename, __stat_buf); +#else + return -1; /* Error in the unlikely event we get called on *BSD* */ +#endif +}