From: Ray Strode Date: Sun, 21 Oct 2007 22:29:08 +0000 (-0400) Subject: Use posix_openpt instead of open ("/dev/ptmx", ...) X-Git-Tag: 0.1.0~143^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b347d89b7bc9d801b70ffa0321bb46d2a57aef3c;p=thirdparty%2Fplymouth.git 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. --- diff --git a/src/libply/ply-terminal.c b/src/libply/ply-terminal.c index 19d85e6d..b6dc64c2 100644 --- a/src/libply/ply-terminal.c +++ b/src/libply/ply-terminal.c @@ -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");