Use posix_openpt instead of open ("/dev/ptmx", ...)

I don't remember why I had posix_openpt disabled, but
undisabling it seems to work fine, so better to use it
unless I find some reason (again?) to disable it.
This commit is contained in:
Ray Strode 2007-10-21 18:29:08 -04:00
parent 122daae898
commit b347d89b7b

View file

@ -74,10 +74,7 @@ ply_terminal_create_device (ply_terminal_t *terminal)
assert (!ply_terminal_has_device (terminal));
ply_trace ("opening device '/dev/ptmx'");
#if 0
terminal->fd = posix_openpt (O_RDWR | O_NOCTTY);
#endif
terminal->fd = open ("/dev/ptmx", O_RDWR | O_NOCTTY);
if (terminal->fd < 0)
return false;
@ -86,10 +83,10 @@ ply_terminal_create_device (ply_terminal_t *terminal)
ply_trace ("creating pseudoterminal");
if (grantpt (terminal->fd) < 0)
{
saved_errno = errno;
ply_save_errno ();
ply_trace ("could not create psuedoterminal: %m");
ply_terminal_destroy_device (terminal);
errno = saved_errno;
ply_restore_errno ();
return false;
}
ply_trace ("done creating pseudoterminal");
@ -97,9 +94,9 @@ ply_terminal_create_device (ply_terminal_t *terminal)
ply_trace ("unlocking pseudoterminal");
if (unlockpt (terminal->fd) < 0)
{
saved_errno = errno;
ply_save_errno ();
ply_terminal_destroy_device (terminal);
errno = saved_errno;
ply_restore_errno ();
return false;
}
ply_trace ("unlocked pseudoterminal");