A process has normally a controlling terminal (the one referred by /dev/tty, revealed by the "tty" command), and that terminal is attached to a group of process. ioctl(TIOCNOTTY) detaches the process from its controlling terminal. If the process is a session leader, it also detaches the controlling terminal from its process group. But there was bug: the terminal was always detached from its process group, including when it was called by a standard child process (i.e. when a daemon forks).