Lines Matching defs:tty

6  * Allocating a pseudo-terminal, and making it the controlling tty.
59 * descriptors for the pty and tty sides and the name of the tty side are
93 /* Releases the tty. Its ownership is returned to root, and permissions to 0666. */
96 pty_release(const char *tty)
99 if (chown(tty, (uid_t) 0, (gid_t) 0) < 0)
100 error("chown %.100s 0 0 failed: %.100s", tty, strerror(errno));
101 if (chmod(tty, (mode_t) 0666) < 0)
102 error("chmod %.100s 0666 failed: %.100s", tty, strerror(errno));
106 /* Makes the tty the process's controlling tty and sets it to sane modes. */
109 pty_make_controlling_tty(int *ttyfd, const char *tty)
117 fd = open(tty, O_RDWR|O_NOCTTY);
125 error("Failed to disconnect from controlling tty.");
128 debug("Setting controlling tty using TCSETCTTY.");
130 fd = open("/dev/tty", O_RDWR);
132 error("%.100s: %.100s", tty, strerror(errno));
137 /* First disconnect from the old controlling tty. */
150 * tty.
154 error("Failed to disconnect from controlling tty.");
157 /* Make it our controlling tty. */
159 debug("Setting controlling tty using TIOCSCTTY.");
167 fd = open(tty, O_RDWR);
169 error("%.100s: %.100s", tty, strerror(errno));
173 /* Verify that we now have a controlling tty. */
176 error("open /dev/tty failed - could not set controlling tty: %.100s",
200 pty_setowner(struct passwd *pw, const char *tty)
207 /* Determine the group to make the owner of the tty. */
208 grp = getgrnam("tty");
213 * Change owner and mode of the tty as required.
215 * tty is owned by root.
217 if (stat(tty, &st))
218 fatal("stat(%.100s) failed: %.100s", tty,
222 ssh_selinux_setup_pty(pw->pw_name, tty);
226 if (chown(tty, pw->pw_uid, gid) < 0) {
230 tty, (u_int)pw->pw_uid, (u_int)gid,
234 tty, (u_int)pw->pw_uid, (u_int)gid,
240 if (chmod(tty, mode) < 0) {
244 tty, (u_int)mode, strerror(errno));
247 tty, (u_int)mode, strerror(errno));