summaryrefslogtreecommitdiffstats
path: root/usr.bin/login/login.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2002-08-19 20:54:00 +0000
committerimp <imp@FreeBSD.org>2002-08-19 20:54:00 +0000
commitdcbe7e6b18000216dc90efe97e087bbbdeb60e1e (patch)
tree141db0e6cd1e13fcd53008a49e0598fb7566cd58 /usr.bin/login/login.c
parent426d833605d357f05e66799ccb4d3f62476a875d (diff)
downloadFreeBSD-src-dcbe7e6b18000216dc90efe97e087bbbdeb60e1e.zip
FreeBSD-src-dcbe7e6b18000216dc90efe97e087bbbdeb60e1e.tar.gz
When login tries to do the chmod/chflags on a read only file system,
it complains that it can't do it because the filesystem is readonly. Assume that when the user has a readonly /dev that they don't care if login can't change the permissions/flags. While this does break a few things like msgs, we'll assume that the user setting up the read only system knows what they are doing. All this change does is to stop the complaint when the file system is read only. It also adds comments as to why EROFS and EOPNOTSUPP are ignored. This allows one to have a read-only / w/o a /dev MFS and have a relatively warning-free existence. /etc/rc still complains when it can't chown/chflags/chmod things, but that's easy to ignore/tweak. Reviewed by: roberto, phk Sponsored by: Timing Solutions
Diffstat (limited to 'usr.bin/login/login.c')
-rw-r--r--usr.bin/login/login.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 03f279e..6b03a1c 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -410,12 +410,21 @@ main(int argc, char *argv[])
* user sets them otherwise, this can cause the chown to fail.
* Since it isn't clear that flags are useful on character
* devices, we just clear them.
+ *
+ * We don't log in the case of EOPNOTSUPP because dev might be
+ * on NFS, which doesn't support chflags.
+ *
+ * We don't log in the EROFS because that means that /dev is on
+ * a read only file system and we assume that the permissions there
+ * are sane.
*/
- if (ttyn != tname && chflags(ttyn, 0) && errno != EOPNOTSUPP)
- syslog(LOG_ERR, "chflags(%s): %m", ttyn);
+ if (ttyn != tname && chflags(ttyn, 0))
+ if (errno != EOPNOTSUPP && errno != EROFS)
+ syslog(LOG_ERR, "chflags(%s): %m", ttyn);
if (ttyn != tname && chown(ttyn, pwd->pw_uid,
(gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid))
- syslog(LOG_ERR, "chmod(%s): %m", ttyn);
+ if (errno != EROFS)
+ syslog(LOG_ERR, "chmod(%s): %m", ttyn);
/*
* Exclude cons/vt/ptys only, assume dialup otherwise
OpenPOWER on IntegriCloud