Correctly set controlling terminal.