here\'s a weird thing I found today on Mac OSX.
After a fork, which has succeeded, errno is set at 0 in the father\'s process (as expected), but set at 22 in the chi
POSIX says:
Upon successful completion, fork() shall return 0 to the child process and shall return the process ID of the child process to the parent process. Both processes shall continue to execute from the fork() function. Otherwise, -1 shall be returned to the parent process, no child process shall be created, and errno shall be set to indicate the error.
which means errno is specified to be set on success only. Otherwise nothing is specified, so you can expect an old value of errno or any unspecified value.