1 #include <sys/types.h> 2 #include <sys/wait.h> 3 #include <unistd.h> 4 #include <stdio.h> 5 6 /* 7 * The point of this test is primarily to test 8 * __attribute__((__transparent_union__)); This is used on some GNU- 9 * aware systems to declare the wait() function 10 */ 11 int main()12main() { 13 pid_t pid; 14 15 if ((pid = fork()) == (pid_t)-1) { 16 perror("fork"); 17 return 1; 18 } else if (pid == 0) { 19 _exit(5); 20 } else { 21 int status; 22 23 wait(&status); 24 if (WEXITSTATUS(status) != 5) { 25 puts("BUG"); 26 } else { 27 puts("OK"); 28 } 29 } 30 return 0; 31 } 32 33