ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/ptytty.C
(Generate patch)

Comparing rxvt-unicode/src/ptytty.C (file contents):
Revision 1.65 by ayin, Tue Jun 26 21:30:10 2007 UTC vs.
Revision 1.68 by ayin, Tue Dec 11 21:49:12 2007 UTC

86 86
87 if (pfd >= 0) 87 if (pfd >= 0)
88 { 88 {
89 if (grantpt (pfd) == 0 /* change slave permissions */ 89 if (grantpt (pfd) == 0 /* change slave permissions */
90 && unlockpt (pfd) == 0) 90 && unlockpt (pfd) == 0)
91 {
91 { /* slave now unlocked */ 92 /* slave now unlocked */
92 *ttydev = strdup (ptsname (pfd)); /* get slave's name */ 93 *ttydev = strdup (ptsname (pfd)); /* get slave's name */
93 return pfd; 94 return pfd;
94 } 95 }
95 96
96 close (pfd); 97 close (pfd);
104 static int 105 static int
105 get_pty (int *fd_tty, char **ttydev) 106 get_pty (int *fd_tty, char **ttydev)
106 { 107 {
107 int pfd; 108 int pfd;
108 int res; 109 int res;
109 char tty_name[32];
110 110
111 res = openpty (&pfd, fd_tty, tty_name, NULL, NULL); 111 res = openpty (&pfd, fd_tty, NULL, NULL, NULL);
112 112
113 if (res != -1) 113 if (res != -1)
114 { 114 {
115 *ttydev = strdup (tty_name); 115 *ttydev = strdup (ttyname (*fd_tty));
116 return pfd; 116 return pfd;
117 } 117 }
118 118
119 return -1; 119 return -1;
120 } 120 }
123 123
124 static int 124 static int
125 get_pty (int *fd_tty, char **ttydev) 125 get_pty (int *fd_tty, char **ttydev)
126 { 126 {
127 int pfd; 127 int pfd;
128 char *slave;
128 129
129 *ttydev = _getpty (&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0); 130 slave = _getpty (&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0);
130 131
131 if (*ttydev != NULL) 132 if (slave != NULL) {
133 *ttydev = strdup (slave);
132 return pfd; 134 return pfd;
135 }
133 136
134 return -1; 137 return -1;
135 } 138 }
136 139
137#elif defined(HAVE_DEV_PTC) 140#elif defined(HAVE_DEV_PTC)
323 { 326 {
324#ifdef TTY_GID_SUPPORT 327#ifdef TTY_GID_SUPPORT
325 struct group *gr = getgrnam ("tty"); 328 struct group *gr = getgrnam ("tty");
326 329
327 if (gr) 330 if (gr)
331 {
328 { /* change group ownership of tty to "tty" */ 332 /* change group ownership of tty to "tty" */
329 mode = S_IRUSR | S_IWUSR | S_IWGRP; 333 mode = S_IRUSR | S_IWUSR | S_IWGRP;
330 gid = gr->gr_gid; 334 gid = gr->gr_gid;
331 } 335 }
332 else 336 else
333#endif /* TTY_GID_SUPPORT */ 337#endif /* TTY_GID_SUPPORT */
334 { 338 {
335 mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH; 339 mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH;
336 gid = 0; 340 gid = 0;
337 } 341 }
338 } 342 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines