* libmisc/failure.c: Try to close the open file if a failure

occured during lseek(), read() or write().
This commit is contained in:
nekral-guest 2008-06-15 19:16:34 +00:00
parent 68cdac68cb
commit dcd480ffd9
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2008-06-15 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/failure.c: Try to close the open file if a failure
occured during lseek(), read() or write().
2008-06-15 Nicolas François <nicolas.francois@centraliens.net>
* libmisc/log.c: Check return values. If lseek() failed, avoid

View File

@ -114,6 +114,7 @@ void failure (uid_t uid, const char *tty, struct faillog *fl)
SYSLOG ((LOG_WARN,
"Can't write faillog entry for UID %lu in %s.",
(unsigned long) uid, FAILLOG_FILE));
(void) close (fd);
}
}
@ -212,6 +213,7 @@ int failcheck (uid_t uid, struct faillog *fl, bool failed)
SYSLOG ((LOG_WARN,
"Can't reset faillog entry for UID %lu in %s.",
(unsigned long) uid, FAILLOG_FILE));
(void) close (fd);
}
} else {
(void) close (fd);
@ -341,6 +343,7 @@ void failtmp (
SYSLOG ((LOG_WARN,
"Can't append failure of user %s to %s.",
ut_user, ftmp));
(void) close (fd);
}
}