]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Use posix_openpt instead of open ("/dev/ptmx", ...)
authorRay Strode <rstrode@redhat.com>
Sun, 21 Oct 2007 22:29:08 +0000 (18:29 -0400)
committerRay Strode <rstrode@redhat.com>
Sun, 21 Oct 2007 22:29:08 +0000 (18:29 -0400)
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.

src/libply/ply-terminal.c

index 19d85e6d04d73d954f1b044f31d44843b71b9f8f..b6dc64c2ba066884bc7b2fd1a0291cce58aba1a6 100644 (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");