diff options
author | Roland McGrath <roland@gnu.org> | 2002-08-31 03:21:56 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-08-31 03:21:56 +0000 |
commit | 37076fcc4c065e307f5946aaf7dbddb6ecbad939 (patch) | |
tree | f18b562b7b81cada12d86120c3a7b365a47203f9 /stdlib/tst-setcontext.c | |
parent | 8fea756af2baa7cf5b4012ee700da3cdd5b10db9 (diff) | |
download | glibc-37076fcc4c065e307f5946aaf7dbddb6ecbad939.tar glibc-37076fcc4c065e307f5946aaf7dbddb6ecbad939.tar.gz glibc-37076fcc4c065e307f5946aaf7dbddb6ecbad939.tar.bz2 glibc-37076fcc4c065e307f5946aaf7dbddb6ecbad939.zip |
* stdlib/tst-setcontext.c (main): If makecontext does nothing,
presume it's the stub and bail without error.
Diffstat (limited to 'stdlib/tst-setcontext.c')
-rw-r--r-- | stdlib/tst-setcontext.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/stdlib/tst-setcontext.c b/stdlib/tst-setcontext.c index 66ea0b7d36..89b8cdfd98 100644 --- a/stdlib/tst-setcontext.c +++ b/stdlib/tst-setcontext.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2001 Free Software Foundation, Inc. +/* Copyright (C) 2001,02 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +19,7 @@ #include <errno.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <ucontext.h> static ucontext_t ctx[3]; @@ -104,7 +105,17 @@ main (void) ctx[1].uc_stack.ss_sp = st1; ctx[1].uc_stack.ss_size = sizeof st1; ctx[1].uc_link = &ctx[0]; - makecontext (&ctx[1], (void (*) (void)) f1, 4, 1, 2, 3, -4); + { + ucontext_t tempctx = ctx[1]; + makecontext (&ctx[1], (void (*) (void)) f1, 4, 1, 2, 3, -4); + + /* Without this check, a stub makecontext can make us spin forever. */ + if (memcmp (&tempctx, &ctx[1], sizeof ctx[1]) == 0) + { + puts ("makecontext was a no-op, presuming not implemented"); + return 0; + } + } if (getcontext (&ctx[2]) != 0) { |