njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 1 | |
| 2 | #include <unistd.h> |
| 3 | #include <sys/types.h> |
| 4 | #include <stdio.h> |
| 5 | |
| 6 | int main(void) |
| 7 | { |
| 8 | pid_t pid; |
| 9 | |
| 10 | pid = fork (); |
| 11 | |
njn | 9198008 | 2002-09-27 10:38:20 +0000 | [diff] [blame] | 12 | /* Sometimes child goes first (non-zero), sometimes parent (zero). This |
| 13 | printing means we can detect if we correctly get a zero result and a |
| 14 | non-zero result (--> three 'X's printed), but the output doesn't depend |
| 15 | on the order. */ |
| 16 | |
| 17 | printf("%s", pid==0 ? "X" : "XX"); |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 18 | |
| 19 | return 0; |
| 20 | } |