swapped broken ptsname() for ptsname_r()