version 1.7, 2002/06/24 17:57:20 |
version 1.7.2.2, 2003/09/16 21:20:29 |
|
|
error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno)); |
error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno)); |
} |
} |
|
|
/* Makes the tty the processes controlling tty and sets it to sane modes. */ |
/* Makes the tty the process's controlling tty and sets it to sane modes. */ |
|
|
void |
void |
pty_make_controlling_tty(int *ttyfd, const char *ttyname) |
pty_make_controlling_tty(int *ttyfd, const char *ttyname) |
|
|
if (chown(ttyname, pw->pw_uid, gid) < 0) { |
if (chown(ttyname, pw->pw_uid, gid) < 0) { |
if (errno == EROFS && |
if (errno == EROFS && |
(st.st_uid == pw->pw_uid || st.st_uid == 0)) |
(st.st_uid == pw->pw_uid || st.st_uid == 0)) |
error("chown(%.100s, %u, %u) failed: %.100s", |
debug("chown(%.100s, %u, %u) failed: %.100s", |
ttyname, (u_int)pw->pw_uid, (u_int)gid, |
ttyname, (u_int)pw->pw_uid, (u_int)gid, |
strerror(errno)); |
strerror(errno)); |
else |
else |
|
|
if (chmod(ttyname, mode) < 0) { |
if (chmod(ttyname, mode) < 0) { |
if (errno == EROFS && |
if (errno == EROFS && |
(st.st_mode & (S_IRGRP | S_IROTH)) == 0) |
(st.st_mode & (S_IRGRP | S_IROTH)) == 0) |
error("chmod(%.100s, 0%o) failed: %.100s", |
debug("chmod(%.100s, 0%o) failed: %.100s", |
ttyname, mode, strerror(errno)); |
ttyname, (u_int)mode, strerror(errno)); |
else |
else |
fatal("chmod(%.100s, 0%o) failed: %.100s", |
fatal("chmod(%.100s, 0%o) failed: %.100s", |
ttyname, mode, strerror(errno)); |
ttyname, (u_int)mode, strerror(errno)); |
} |
} |
} |
} |
} |
} |