blob: 22a7c211b743b34255ad26c99cf4569730f417ee [file] [log] [blame]
njn25e49d8e72002-09-23 09:36:25 +00001
2#include <unistd.h>
3#include <sys/types.h>
fitzhardinge0996fa62004-01-06 21:46:02 +00004#include <sys/wait.h>
njn25e49d8e72002-09-23 09:36:25 +00005#include <stdio.h>
6
7int main(void)
8{
9 pid_t pid;
10
11 pid = fork ();
12
njn91980082002-09-27 10:38:20 +000013 /* Sometimes child goes first (non-zero), sometimes parent (zero). This
14 printing means we can detect if we correctly get a zero result and a
15 non-zero result (--> three 'X's printed), but the output doesn't depend
16 on the order. */
17
18 printf("%s", pid==0 ? "X" : "XX");
njn25e49d8e72002-09-23 09:36:25 +000019
fitzhardinge0996fa62004-01-06 21:46:02 +000020 if (pid != 0)
21 waitpid(pid, NULL, 0);
22
njn25e49d8e72002-09-23 09:36:25 +000023 return 0;
24}