* libmisc/chowntty.c: Improve the logs for fchown and fchmod

failures.
This commit is contained in:
nekral-guest 2008-11-23 00:05:39 +00:00
parent 2b290e7abb
commit cf31f05cfb
2 changed files with 10 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2008-11-23 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/chowntty.c: Improve the logs for fchown and fchmod
failures.
2008-11-23 Nicolas François <nicolas.francois@centraliens.net>
* NEWS, libmisc/chowntty.c: Fix a race condition that could lead to

View File

@ -83,13 +83,12 @@ void chown_tty (const struct passwd *info)
|| (fchmod (STDIN_FILENO, getdef_num ("TTYPERM", 0600)) != 0)) {
int err = errno;
snprintf (buf, sizeof buf, _("Unable to change tty stdin"));
perror (buf);
fprintf (stderr,
_("Unable to change owner or mode of tty stdin: %s"),
strerror (err));
SYSLOG ((LOG_WARN,
"unable to change tty stdin for user `%s'\n",
info->pw_name));
closelog ();
"unable to change owner or mode of tty stdin for user `%s': %s\n",
info->pw_name, strerror (err)));
if (EROFS != err) {
exit (1);
}