Various faffs in the pty allocation process to get controlling