From dcd480ffd9a2443fdf8d492efdaf2d1d9aa224b9 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sun, 15 Jun 2008 19:16:34 +0000 Subject: [PATCH] * libmisc/failure.c: Try to close the open file if a failure occured during lseek(), read() or write(). --- ChangeLog | 5 +++++ libmisc/failure.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 93b1e5fd..9cb53d15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-15 Nicolas François + + * libmisc/failure.c: Try to close the open file if a failure + occured during lseek(), read() or write(). + 2008-06-15 Nicolas François * libmisc/log.c: Check return values. If lseek() failed, avoid diff --git a/libmisc/failure.c b/libmisc/failure.c index cae4f876..5afc439a 100644 --- a/libmisc/failure.c +++ b/libmisc/failure.c @@ -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); } }