PREV INDEX NEXT

Author: Unknown
Subject: Fork Error Handling
Date: Tuesday, 08 Dec 2020, 18:09:36

If if((pid=fork()) < 0) , should we be calling `return` on the error or `exit()`?

Normally, we need to call exit() in the child process. However, if fork() fails and we call exit(), won't it terminate the entire program? Or will it just break out of a defective child process?
PREV INDEX NEXT