about summary refs log tree commit diff
path: root/login/utmp_file.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-08-13 12:09:32 +0200
committerFlorian Weimer <fweimer@redhat.com>2019-08-13 12:09:32 +0200
commita33b817f13170b5c24263b92e7e09880fe797d7e (patch)
tree232dc87b4dcfaacf85cc9b01f9c72f5602e38307 /login/utmp_file.c
parent9b9670fcd8ca92d6f53465e98173e3b33a76182c (diff)
downloadglibc-a33b817f13170b5c24263b92e7e09880fe797d7e.tar.gz
glibc-a33b817f13170b5c24263b92e7e09880fe797d7e.tar.xz
glibc-a33b817f13170b5c24263b92e7e09880fe797d7e.zip
login: Assume that _HAVE_UT_* constants are true
Make the GNU version of bits/utmp.h the generic version because
all remaining ports use it (with a sysdeps override for
Linux s390/s390x).
Diffstat (limited to 'login/utmp_file.c')
-rw-r--r--login/utmp_file.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/login/utmp_file.c b/login/utmp_file.c
index cb8a02825c..9badf11fb3 100644
--- a/login/utmp_file.c
+++ b/login/utmp_file.c
@@ -129,14 +129,7 @@ __libc_setutent (void)
   file_offset = 0;
 
   /* Make sure the entry won't match.  */
-#if _HAVE_UT_TYPE - 0
   last_entry.ut_type = -1;
-#else
-  last_entry.ut_line[0] = '\177';
-# if _HAVE_UT_ID - 0
-  last_entry.ut_id[0] = '\0';
-# endif
-#endif
 
   return 1;
 }
@@ -201,7 +194,6 @@ internal_getut_r (const struct utmp *id, struct utmp *buffer,
       LOCKING_FAILED ();
     }
 
-#if _HAVE_UT_TYPE - 0
   if (id->ut_type == RUN_LVL || id->ut_type == BOOT_TIME
       || id->ut_type == OLD_TIME || id->ut_type == NEW_TIME)
     {
@@ -225,7 +217,6 @@ internal_getut_r (const struct utmp *id, struct utmp *buffer,
 	}
     }
   else
-#endif /* _HAVE_UT_TYPE */
     {
       /* Search for the next entry with the specified ID and with type
 	 INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS.  */
@@ -316,13 +307,10 @@ __libc_getutline_r (const struct utmp *line, struct utmp *buffer,
       file_offset += sizeof (struct utmp);
 
       /* Stop if we found a user or login entry.  */
-      if (
-#if _HAVE_UT_TYPE - 0
-	  (last_entry.ut_type == USER_PROCESS
+      if ((last_entry.ut_type == USER_PROCESS
 	   || last_entry.ut_type == LOGIN_PROCESS)
-	  &&
-#endif
-	  !strncmp (line->ut_line, last_entry.ut_line, sizeof line->ut_line))
+	  && (strncmp (line->ut_line, last_entry.ut_line, sizeof line->ut_line)
+	      == 0))
 	break;
     }
 
@@ -368,16 +356,12 @@ __libc_pututline (const struct utmp *data)
 
   /* Find the correct place to insert the data.  */
   if (file_offset > 0
-      && (
-#if _HAVE_UT_TYPE - 0
-	  (last_entry.ut_type == data->ut_type
+      && ((last_entry.ut_type == data->ut_type
 	   && (last_entry.ut_type == RUN_LVL
 	       || last_entry.ut_type == BOOT_TIME
 	       || last_entry.ut_type == OLD_TIME
 	       || last_entry.ut_type == NEW_TIME))
-	  ||
-#endif
-	  __utmp_equal (&last_entry, data)))
+	  || __utmp_equal (&last_entry, data)))
     found = 1;
   else
     {