*** empty log message ***
authorayin <ayin>
Thu, 28 Jun 2007 17:47:14 +0000 (17:47 +0000)
committerayin <ayin>
Thu, 28 Jun 2007 17:47:14 +0000 (17:47 +0000)
src/ptytty.C

index 384c38fbdd0fb6b2e93bb21ba7f155de641d4e62..45181450d704c7a0c360c823f362596b0fc43720 100644 (file)
   {
     int pfd;
     int res;
-    char tty_name[32];
 
-    res = openpty (&pfd, fd_tty, tty_name, NULL, NULL);
+    res = openpty (&pfd, fd_tty, NULL, NULL, NULL);
 
     if (res != -1)
       {
-        *ttydev = strdup (tty_name);
+        *ttydev = strdup (ttyname (*fd_tty));
         return pfd;
       }
 
   get_pty (int *fd_tty, char **ttydev)
   {
     int pfd;
+    char *slave;
 
-    *ttydev = _getpty (&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0);
+    slave = _getpty (&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0);
 
-    if (*ttydev != NULL)
+    if (slave != NULL) {
+      *ttydev = strdup (slave);
       return pfd;
+    }
 
     return -1;
   }