]> granicus.if.org Git - shadow/commitdiff
* libmisc/failure.c: Try to close the open file if a failure
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 15 Jun 2008 19:16:34 +0000 (19:16 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Sun, 15 Jun 2008 19:16:34 +0000 (19:16 +0000)
occured during lseek(), read() or write().

ChangeLog
libmisc/failure.c

index 93b1e5fd0f8d9e643c1bbce02cb05ff72b873254..9cb53d15d26dbc68dc1fcb064f56b62dc2d28e0f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index cae4f8769b9f3743507e03489d659460292d723b..5afc439acefa70d23119f3bf183242026cf4324f 100644 (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);
        }
 }