Wrong, waitpid(-1, ...) waits on all child processes of the current process, and would return -1 with errno set to ECHLD if there is no children.
The point about missing error checking still stands though!
The point about missing error checking still stands though!