Skip to content

Commit

Permalink
* stdlib/tst-setcontext.c (main): If makecontext does nothing,
Browse files Browse the repository at this point in the history
	presume it's the stub and bail without error.
  • Loading branch information
Roland McGrath committed Aug 31, 2002
1 parent 8fea756 commit 37076fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2002-08-30 Roland McGrath <roland@redhat.com>

* stdlib/tst-setcontext.c (main): If makecontext does nothing,
presume it's the stub and bail without error.

* nss/getnssent_r.c (__nss_getent_r): Return ENOENT if status is
neither SUCCESS nor TRYAGAIN (see 2002-08-25 change [PR libc/4259]).

Expand Down
15 changes: 13 additions & 2 deletions stdlib/tst-setcontext.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,6 +19,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ucontext.h>

static ucontext_t ctx[3];
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 37076fc

Please sign in to comment.