This page describes the guaranteed behavior of the functions
readdir_r and contains the following sentence:
After a call to fork(), either the parent or child (but not both) may continue processing the directory stream using readdir(), rewinddir() or seekdir(). If both the parent and child processes use these functions, the result is undefined.
I'm writing a fork-safe wrapper around the
DIR*-related family of functions as an exercise and I'm wondering whether it's safe to
closedir the directory stream in both the parent and the child simultaneously or whether the process that doesn't continue reading from the directory stream isn't supposed to interact with the directory stream at all.