If you disassociate the process from its parent (via setsid), this won't happen. When you kill your terminal (or exit it any way other than by typing "exit" or "logout"), a HUP signal is sent to the terminal's process group. This means every process that currently is in the shell's process group receives the HUP signal, which effectively kills everything started during that shell session.

With the second call to fork, we are guaranteed that the child is not a session leader and therefore cannot acquire a controlling terminal. We ignore SIGHUP since the session leader is soon to be terminated. Just an expansion on what you said. I certainly admire and trust the late Mr. Stevens very much!

When putting a smiley right before a closing parenthesis, do you:

Use two parentheses: (Like this: :) )
Use one parenthesis: (Like this: :)
Reverse direction of the smiley: (Like this: (: )
Use angle/square brackets instead of parentheses
Use C-style commenting to set the smiley off from the closing parenthesis
Make the smiley a dunce: (:>
I disapprove of emoticons
Other