aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-04-23 21:16:32 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2024-04-26 17:16:06 +1100
commitefc9aac02e235bd5994b52ba6417a4890ad5c1d4 (patch)
tree2a629ef448a60c382c88de65772780cff95e5512
parenticonv: ISO-2022-CN-EXT: fix out-of-bound writes when writing escape sequence ... (diff)
downloadglibc-efc9aac02e235bd5994b52ba6417a4890ad5c1d4.tar.gz
glibc-efc9aac02e235bd5994b52ba6417a4890ad5c1d4.tar.bz2
glibc-efc9aac02e235bd5994b52ba6417a4890ad5c1d4.zip
nptl: Fix tst-cancel30 on kernels without ppoll_time64 support
Fall back to ppoll if ppoll_time64 fails with ENOSYS. Fixes commit 370da8a121c3ba9eeb2f13da15fc0f21f4136b25 ("nptl: Fix tst-cancel30 on sparc64"). Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> (cherry picked from commit f4724843ada64a51d66f65d3199fe431f9d4c254) (cherry picked from commit e828914cf9f2fc2caa5bced0fc6a03cb78324979)
-rw-r--r--sysdeps/pthread/tst-cancel30.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sysdeps/pthread/tst-cancel30.c b/sysdeps/pthread/tst-cancel30.c
index 3030660e5f..94ad6281bc 100644
--- a/sysdeps/pthread/tst-cancel30.c
+++ b/sysdeps/pthread/tst-cancel30.c
@@ -18,6 +18,7 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
+#include <errno.h>
#include <support/check.h>
#include <support/xstdio.h>
#include <support/xthread.h>
@@ -46,13 +47,19 @@ tf (void *arg)
/* Wait indefinitely for cancellation, which only works if asynchronous
cancellation is enabled. */
-#if defined SYS_ppoll || defined SYS_ppoll_time64
-# ifndef SYS_ppoll_time64
-# define SYS_ppoll_time64 SYS_ppoll
+#ifdef SYS_ppoll_time64
+ long int ret = syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
+ (void) ret;
+# ifdef SYS_ppoll
+ if (ret == -1 && errno == ENOSYS)
+ syscall (SYS_ppoll, NULL, 0, NULL, NULL);
# endif
- syscall (SYS_ppoll_time64, NULL, 0, NULL, NULL);
#else
+# ifdef SYS_ppoll
+ syscall (SYS_ppoll, NULL, 0, NULL, NULL);
+# else
for (;;);
+# endif
#endif
return 0;