There is a race condition in old libc in fork(). The result was that 'end' was sometimes printed twice. This did not happen with glibc-2.32.
Unified · Split
| @@ -116,8 +116,6 @@ main (void) · 115 unmodified lines | ||
| 116 | 116 | while (time(NULL) < end) ; |
| 117 | 117 | run = 0; |
| 118 | 118 | |
| 119 | − printf ("end\n"); fflush(stdout); | |
| 120 | − | |
| 121 | 119 | pthread_join(id1, NULL); |
| 122 | 120 | pthread_join(id2, NULL); |
| 123 | 121 | #if !defined(__APPLE__) |
| @@ -126,6 +124,8 @@ main (void) · 2 unmodified lines | ||
| 126 | 124 | sem_destroy (&sem); |
| 127 | 125 | sem_destroy (&sem_child); |
| 128 | 126 | |
| 127 | + printf ("end\n"); fflush(stdout); | |
| 128 | + | |
| 129 | 129 | sigemptyset (&m); |
| 130 | 130 | sigprocmask (SIG_SETMASK, &m, NULL); |
| 131 | 131 | if (sigsetjmp (sj, 0) == 0) |