version 1.1.4.2, 2001/05/07 21:09:38 |
version 1.1.4.3, 2001/09/27 00:15:43 |
|
|
|
|
/* |
/* |
* Change owner and mode of the tty as required. |
* Change owner and mode of the tty as required. |
* Warn but continue if filesystem is read-only and the uids match. |
* Warn but continue if filesystem is read-only and the uids match/ |
|
* tty is owned by root. |
*/ |
*/ |
if (stat(ttyname, &st)) |
if (stat(ttyname, &st)) |
fatal("stat(%.100s) failed: %.100s", ttyname, |
fatal("stat(%.100s) failed: %.100s", ttyname, |
|
|
|
|
if (st.st_uid != pw->pw_uid || st.st_gid != gid) { |
if (st.st_uid != pw->pw_uid || st.st_gid != gid) { |
if (chown(ttyname, pw->pw_uid, gid) < 0) { |
if (chown(ttyname, pw->pw_uid, gid) < 0) { |
if (errno == EROFS && st.st_uid == pw->pw_uid) |
if (errno == EROFS && |
|
(st.st_uid == pw->pw_uid || st.st_uid == 0)) |
error("chown(%.100s, %d, %d) failed: %.100s", |
error("chown(%.100s, %d, %d) failed: %.100s", |
ttyname, pw->pw_uid, gid, |
ttyname, pw->pw_uid, gid, |
strerror(errno)); |
strerror(errno)); |