Consider this code snippet:
pid_t cpid = fork(); if (cpid == -1) { perror(\"fork\"); exit(EXIT_FAILURE); } if (cpid == 0) { // in child execvp(
The child of fork() should always call _exit().
Calling exit() instead is a good way to cause pending stdio buffers to be flushed twice.