about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
Diffstat (limited to 'login')
-rw-r--r--login/getutid.c6
-rw-r--r--login/login.c2
-rw-r--r--login/programs/xtmp.c29
-rw-r--r--login/programs/xtmp.h3
4 files changed, 24 insertions, 16 deletions
diff --git a/login/getutid.c b/login/getutid.c
index d3d3b5d068..98e8e4adc3 100644
--- a/login/getutid.c
+++ b/login/getutid.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -25,7 +25,7 @@ static struct utmp buffer;
 
 
 struct utmp *
-getutid (const struct utmp *id)
+__getutid (const struct utmp *id)
 {
   struct utmp *result;
 
@@ -34,3 +34,5 @@ getutid (const struct utmp *id)
 
   return result;
 }
+weak_alias (__getutid, getutid)
+weak_alias (__getutid, getutxid)
diff --git a/login/login.c b/login/login.c
index 075ef15056..4d08dbb472 100644
--- a/login/login.c
+++ b/login/login.c
@@ -115,7 +115,7 @@ login (const struct utmp *ut)
       strncpy (copy.ut_line, ttyp, UT_LINESIZE);
 
       /* Tell that we want to use the UTMP file.  */
-      if (utmpname (_PATH_UTMP) != 0)
+      if (utmpname (_PATH_UTMP) == 0)
 	{
 	  struct utmp *old;
 
diff --git a/login/programs/xtmp.c b/login/programs/xtmp.c
index 105145b01d..e27e1a8a86 100644
--- a/login/programs/xtmp.c
+++ b/login/programs/xtmp.c
@@ -85,30 +85,37 @@ utmp_to_xtmp (const struct utmp *utmp, struct xtmp *xtmp)
 
 /* Compare an old style entry XTMP with a new style entry UTMP.  The
    function returns 1 if the information that is in both old and new
-   style entries is identical.  Otherwise this function returns 0.  */
+   style entries is identical.  Otherwise this function returns 0.
+   
+   The type of the argument `xtmp' is `struct utmp *', not `struct
+   utmp *'.  This is intentional!  We convert from and to `struct
+   xtmp' directly when we read and write an old style entry.  But
+   since XTMP is converted from an old style entry, we compare only
+   those elements of the structure that are common to both the new and
+   the old style entry.  */
 int
-compare_entry (const struct xtmp *xtmp, const struct utmp *utmp)
+compare_entry (const struct utmp *xtmp, const struct utmp *utmp)
 {
   return
     (
 #if _HAVE_XT_TYPE - 0
-     xtmp->xt_type == utmp->ut_type
+     xtmp->ut_type == utmp->ut_type
 #endif
 #if _HAVE_XT_PID - 0
-     && xtmp->xt_pid == utmp->ut_pid
+     && xtmp->ut_pid == utmp->ut_pid
 #endif
-     && !strncmp (xtmp->xt_line, utmp->ut_line, XT_LINESIZE - 1)
+     && !strncmp (xtmp->ut_line, utmp->ut_line, XT_LINESIZE - 1)
 #if _HAVE_XT_ID - 0
-     && !strncmp (xtmp->xt_id, utmp->ut_id, sizeof utmp->ut_id)
+     && !strncmp (xtmp->ut_id, utmp->ut_id, sizeof utmp->ut_id)
 #endif
 #if _HAVE_UT_TV - 0
-     && xtmp->xt_time == utmp->ut_tv.tv_sec
+     && xtmp->ut_tv.tv_sec == utmp->ut_tv.tv_sec
 #else
-     && xtmp->xt_time == utmp->ut_time
+     && xtmp->ut_time == utmp->ut_time
 #endif
-     && !strncmp (xtmp->xt_user, utmp->ut_user, XT_NAMESIZE)
+     && !strncmp (xtmp->ut_user, utmp->ut_user, XT_NAMESIZE)
 #if _HAVE_XT_HOST - 0
-     && !strncmp (xtmp->xt_host, utmp->ut_host, XT_HOSTSIZE - 1)
+     && !strncmp (xtmp->ut_host, utmp->ut_host, XT_HOSTSIZE - 1)
 #endif
-     && xtmp->xt_addr == utmp->ut_addr);
+     && xtmp->ut_addr == utmp->ut_addr);
 }
diff --git a/login/programs/xtmp.h b/login/programs/xtmp.h
index 508993248a..25949ef6dd 100644
--- a/login/programs/xtmp.h
+++ b/login/programs/xtmp.h
@@ -20,7 +20,6 @@
 
 #ifndef _XTMP_H
 #define _XTMP_H		1
-#include <features.h>
 
 #include <sys/time.h>
 #include <sys/types.h>
@@ -50,7 +49,7 @@ struct xtmp
 
 extern void xtmp_to_utmp (const struct xtmp *xtmp, struct utmp *utmp);
 extern void utmp_to_xtmp (const struct utmp *utmp, struct xtmp *xtmp);
-extern int compare_entry (const struct xtmp *xtmp,
+extern int compare_entry (const struct utmp *xtmp,
 			  const struct utmp *utmp);
 
 #endif /* xtmp.h  */