File: waittest.c

package info (click to toggle)
zmailer 2.99.55-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 19,516 kB
  • ctags: 9,694
  • sloc: ansic: 120,953; sh: 3,862; makefile: 3,166; perl: 2,695; python: 115; awk: 22
file content (31 lines) | stat: -rw-r--r-- 565 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* To clear some doubts about signal handling with GNU autoconfig,
   we test a couple things -- exiting, and signal-deaths */

#include <stdio.h>

extern int wait();
extern int fork();

main()
{
  int status;
  int pid;
  pid = fork();
  if (pid == 0) {
    /* Child */
    exit (63);
  }
  pid = wait(&status);
  printf("exit(63) did yield status: 0x%x\n",status);
  fflush(stdout);

  pid = fork();
  if (pid == 0) {
    char *pp = NULL;
    *pp = 0; /* SIGSEGV.. */
  }
  pid = wait(&status);
  printf("SIGSEGV did yield status: 0x%x\n",status);

  return 0;
}