A life as a daemon is not an easy life and requires a lot of gruesome deaths of parent processes.
The first thing needed for a process to become a daemon is to fork as a new process so the parent can exit, and the the prompt is returned to the invoking shell. This ensures that the new process is not a process group leader, since a process group leader cannot create a new session calling setsid. So, the new child process can now be promoted to process group leader and session leader by calling setsid. So far, the new session has no controlling terminal, and so does the new child. So, we fork again to be sure that the session and group leader can exit. Now, the grandchild is not a session, so the terminal it is going to open cannot be its controlling terminal. This is how things work in the hard life of a Linux process; if it is not a session leader, the terminal...