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

Comparing libptytty/src/ptytty.C (file contents):
Revision 1.29 by ayin, Thu Jun 28 17:41:01 2007 UTC vs.
Revision 1.33 by ayin, Thu Dec 13 14:42:33 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);
122 123
123 static int 124 static int
124 get_pty (int *fd_tty, char **ttydev) 125 get_pty (int *fd_tty, char **ttydev)
125 { 126 {
126 int pfd; 127 int pfd;
128 char *slave;
127 129
128 *ttydev = _getpty (&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0); 130 slave = _getpty (&pfd, O_RDWR | O_NONBLOCK | O_NOCTTY, 0622, 0);
129 131
130 if (*ttydev != NULL) 132 if (slave != NULL)
133 {
134 *ttydev = strdup (slave);
131 return pfd; 135 return pfd;
136 }
132 137
133 return -1; 138 return -1;
134 } 139 }
135 140
136#elif defined(HAVE_DEV_PTC) 141#elif defined(HAVE_DEV_PTC)
322 { 327 {
323#ifdef TTY_GID_SUPPORT 328#ifdef TTY_GID_SUPPORT
324 struct group *gr = getgrnam ("tty"); 329 struct group *gr = getgrnam ("tty");
325 330
326 if (gr) 331 if (gr)
332 {
327 { /* change group ownership of tty to "tty" */ 333 /* change group ownership of tty to "tty" */
328 mode = S_IRUSR | S_IWUSR | S_IWGRP; 334 mode = S_IRUSR | S_IWUSR | S_IWGRP;
329 gid = gr->gr_gid; 335 gid = gr->gr_gid;
330 } 336 }
331 else 337 else
332#endif /* TTY_GID_SUPPORT */ 338#endif /* TTY_GID_SUPPORT */
333 { 339 {
334 mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH; 340 mode = S_IRUSR | S_IWUSR | S_IWGRP | S_IWOTH;
335 gid = 0; 341 gid = 0;
336 } 342 }
337 } 343 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines