Check that ttyname is valid