Fix tst-setcontext for getcontext returning ENOSYS
Joseph S. Myers
joseph@codesourcery.com
Tue Jun 17 19:33:00 GMT 2008
The tst-setcontext test checks for getcontext returning an ENOSYS error
(i.e. getcontext not implemented for that platform) and exits with status
0 if so, which should make the test pass as is generally done with tests
for functionality that may not be implemented on all platforms or kernel
versions.
However, since an atexit handler was added this no longer works, because
the handler sees that back_in_main is not set. This patch sets
back_in_main before calling exit in this case. The other obvious
approaches for fixing this would be to move the atexit call later, or to
use _exit in this case.
2008-06-17 Joseph Myers <joseph@codesourcery.com>
* stdlib/tst-setcontext.c: Set back_in_main before exit if
getcontext returns ENOSYS.
Index: stdlib/tst-setcontext.c
===================================================================
RCS file: /cvs/glibc/libc/stdlib/tst-setcontext.c,v
retrieving revision 1.10
diff -u -r1.10 tst-setcontext.c
--- stdlib/tst-setcontext.c 30 Apr 2008 18:08:16 -0000 1.10
+++ stdlib/tst-setcontext.c 17 Jun 2008 19:05:06 -0000
@@ -150,7 +150,10 @@
if (getcontext (&ctx[1]) != 0)
{
if (errno == ENOSYS)
- exit (0);
+ {
+ back_in_main = 1;
+ exit (0);
+ }
printf ("%s: getcontext: %m\n", __FUNCTION__);
exit (1);
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list