Back to index

glibc  2.9
Defines | Functions | Variables
tst-cleanup2.c File Reference
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include "../test-skeleton.c"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


#define TEST_FUNCTION   do_test ()


static void sig_handler (int signo)
static int do_test (void)


static sigjmp_buf jmpbuf

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 62 of file tst-cleanup2.c.

Function Documentation

static int do_test ( void  ) [static]

Definition at line 35 of file tst-cleanup2.c.

  char *p = NULL;
  struct sigaction sa;

  sa.sa_handler = sig_handler;
  sigemptyset (&sa.sa_mask);
  sa.sa_flags = SA_SIGINFO;

  if (sigaction (SIGSEGV, &sa, 0))
      perror ("installing SIGSEGV handler\n");
      exit (1);

  puts ("Attempting to sprintf to null ptr");
  if (setjmp (jmpbuf))
      puts ("Exiting main...");
      return 0;

  sprintf (p, "This should segv\n");

  return 1;

Here is the call graph for this function:

static void sig_handler ( int  signo) [static]

Definition at line 29 of file tst-cleanup2.c.

  siglongjmp (jmpbuf, 1);

Here is the caller graph for this function:

Variable Documentation

sigjmp_buf jmpbuf [static]

Definition at line 26 of file tst-cleanup2.c.