]> granicus.if.org Git - shadow/commitdiff
* lib/prototypes.h: Replace HAVE_UTMPX_H by USE_UTMPX.
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 27 Apr 2009 20:15:09 +0000 (20:15 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 27 Apr 2009 20:15:09 +0000 (20:15 +0000)
* lib/prototypes.h, libmisc/log.c: Added splint annotations.
* libmisc/log.c: Added SYSLOG warning when lseek fails (should not
happen).

ChangeLog
lib/prototypes.h
libmisc/log.c

index 4f1b4eb4a9e59753a671365c59bbc54cf61c4db9..cfca878ef2e8833a17833acdb8c2f499af5eae37 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-27  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * lib/prototypes.h: Replace HAVE_UTMPX_H by USE_UTMPX.
+       * lib/prototypes.h, libmisc/log.c: Added splint annotations.
+       * libmisc/log.c: Added SYSLOG warning when lseek fails (should not
+       happen).
+
 2009-04-27  Nicolas François  <nicolas.francois@centraliens.net>
 
        * libmisc/mail.c, libmisc/copydir.c: Added missing include of
index 32f18bd201b93d77f704bb93200dad890b97a479..1aeabd3b33fa8e8ec957f87bbc50a63f7e76a57d 100644 (file)
@@ -43,7 +43,7 @@
 #define _PROTOTYPES_H
 
 #include <sys/stat.h>
-#if HAVE_UTMPX_H
+#if USE_UTMPX
 #include <utmpx.h>
 #else
 #include <utmp.h>
@@ -217,10 +217,11 @@ extern bool is_on_list (char *const *list, const char *member);
 extern /*@only@*/char **comma_to_list (const char *);
 
 /* log.c */
-extern void dolastlog (struct lastlog *ll,
-                       const struct passwd *pw,
-                       const char *line,
-                       const char *host);
+extern void dolastlog (
+       struct lastlog *ll,
+       const struct passwd *pw,
+       /*@unique@*/const char *line,
+       /*@unique@*/const char *host);
 
 /* login_nopam.c */
 extern int login_access (const char *user, const char *from);
@@ -362,13 +363,13 @@ extern struct utmp *prepare_utmp (const char *name,
                                   const char *host,
                                   /*@null@*/const struct utmp *ut);
 extern int setutmp (struct utmp *ut);
-#ifdef HAVE_UTMPX_H
+#ifdef USE_UTMPX
 extern struct utmpx *prepare_utmpx (const char *name,
                                     const char *line,
                                     const char *host,
                                     /*@null@*/const struct utmp *ut);
 extern int setutmpx (struct utmpx *utx);
-#endif
+#endif                         /* USE_UTMPX */
 
 /* valid.c */
 extern bool valid (const char *, const struct passwd *);
index bc7eb88fcda377ba4774d452bb27af75ead64410..eb84859e0a78eadde4cb5f4842996a20af3a8116 100644 (file)
  *     UID is extracted from the global (struct passwd) entry and the
  *     TTY information is gotten from the (struct utmp).
  */
-void
-dolastlog (struct lastlog *ll, const struct passwd *pw, const char *line,
-          const char *host)
+void dolastlog (
+       struct lastlog *ll,
+       const struct passwd *pw,
+       /*@unique@*/const char *line,
+       /*@unique@*/const char *host)
 {
        int fd;
        off_t offset;
@@ -75,7 +77,10 @@ dolastlog (struct lastlog *ll, const struct passwd *pw, const char *line,
        offset = (off_t) pw->pw_uid * sizeof newlog;
 
        if (lseek (fd, offset, SEEK_SET) != offset) {
-               close (fd);
+               SYSLOG ((LOG_WARN,
+                        "Can't read last lastlog entry for UID %lu in %s. Entry not updated.",
+                        (unsigned long) pw->pw_uid, LASTLOG_FILE));
+               (void) close (fd);
                return;
        }