Index: lib/libc/sys/fork.2 =================================================================== --- lib/libc/sys/fork.2 +++ lib/libc/sys/fork.2 @@ -118,13 +118,20 @@ case -1: err(1, "Failed to fork"); case 0: + /* + * Using stdio safely around fork() requires at least flushing buffers + * and ensuring that opened FILEs are in some consistent state right + * at fork. + */ printf("Hello from child process!\en"); + fflush(stdout); exit(0); default: break; } printf("Hello from parent process (child's PID: %d)!\en", pid); + fflush(stdout); return (0); }