Final answer:
In the provided C++ code, the 'fork()' function returns -1 if an error occurs during the creation of a child process.
Step-by-step explanation:
The code excerpt provided is from a C++ program that uses the fork() system call, which is common in UNIX-based operating systems for creating a new process.
The value returned by the fork() function if an error occurs is -1. If fork() successfully creates a child process, it returns the child's process ID to the parent and returns 0 to the child process.
The provided code handles this by checking if the returned value is -1 and prints an error message accordingly.