ttyname_r: Make it work on Solaris 10.