| Summary: | [PATCH] /usr/bin/login logs errors in non-error situations | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Bjoern Fischer <bfischer> |
| Component: | bin | Assignee: | Sheldon Hearn <sheldonh> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.0-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
Responsible Changed From-To: freebsd-bugs->sheldonh I'll take this one. State Changed From-To: open->analyzed Committed to -CURRENT in rev 1.52 of login.c and rev 1.7 of login_fbtab.c. Merge to follow later. State Changed From-To: analyzed->closed Merged onto the RELENG_4 branch in rev 1.51.2.1 of login.c and rev 1.6.2.1 of login_fbtab.c. The problem did not exist in RELENG_3. |
If /dev/tty* is on a file system that does not support chflags(2) every login procedure generates an error message in syslog. Fix: To fix this errno is checked if it is EOPNOTSUPP. No errors will be logged in that case. See this patch: --- ./usr.bin/login/login.c 2000/04/07 02:55:10 1.1 +++ ./usr.bin/login/login.c 2000/04/07 02:59:35 @@ -492,8 +492,11 @@ * 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. + * + * chflags may fail due to lack of support on file system. In + * this case we ignore the error silently. */ - if (chflags(ttyn, 0)) + if (chflags(ttyn, 0) && (errno != EOPNOTSUPP)) syslog(LOG_ERR, "chmod(%s): %m", ttyn); if (chown(ttyn, pwd->pw_uid, (gr = getgrnam(TTYGRPNAME)) ? gr->gr_gid : pwd->pw_gid)) --- ./usr.bin/login/login_fbtab.c 2000/04/07 02:55:10 1.1 +++ ./usr.bin/login/login_fbtab.c 2000/04/07 03:02:46 @@ -132,8 +132,12 @@ DIR *dir; if (strcmp("/*", path + pathlen - 2) != 0) { - /* clear flags of the device */ - if (chflags(path, 0) && errno != ENOENT) + /* clear flags of the device + * + * chflags may fail due to lack of support on file system. In + * this case we ignore the error silently. + */ + if (chflags(path, 0) && (errno != ENOENT) && (errno != EOPNOTSUPP)) syslog(LOG_ERR, "%s: chflags(%s): %m", table, path); if (chmod(path, mask) && errno != ENOENT) syslog(LOG_ERR, "%s: chmod(%s): %m", table, path); How-To-Repeat: See description.