d8307d
commit 1a7fe2ebe52b3c8bf465d1756e69452d05c1c103
d8307d
Author: Florian Weimer <fweimer@redhat.com>
d8307d
Date:   Mon Aug 5 15:54:10 2019 +0200
d8307d
d8307d
    login: Remove utmp backend jump tables [BZ #23518]
d8307d
    
d8307d
    There is just one file-based implementation, so this dispatch
d8307d
    mechanism is unnecessary.  Instead of the vtable pointer
d8307d
    __libc_utmp_jump_table, use a non-negative file_fd as the indicator
d8307d
    that the backend is initialized.
d8307d
d8307d
diff --git a/login/getutent_r.c b/login/getutent_r.c
d8307d
index 6a244ba6e0b86da7..44239ecb81bacea4 100644
d8307d
--- a/login/getutent_r.c
d8307d
+++ b/login/getutent_r.c
d8307d
@@ -23,115 +23,16 @@
d8307d
 
d8307d
 #include "utmp-private.h"
d8307d
 
d8307d
-
d8307d
-/* Functions defined here.  */
d8307d
-static int setutent_unknown (void);
d8307d
-static int getutent_r_unknown (struct utmp *buffer, struct utmp **result);
d8307d
-static int getutid_r_unknown (const struct utmp *line, struct utmp *buffer,
d8307d
-			      struct utmp **result);
d8307d
-static int getutline_r_unknown (const struct utmp *id, struct utmp *buffer,
d8307d
-				struct utmp **result);
d8307d
-static struct utmp *pututline_unknown (const struct utmp *data);
d8307d
-static void endutent_unknown (void);
d8307d
-
d8307d
-/* Initial Jump table.  */
d8307d
-const struct utfuncs __libc_utmp_unknown_functions =
d8307d
-{
d8307d
-  setutent_unknown,
d8307d
-  getutent_r_unknown,
d8307d
-  getutid_r_unknown,
d8307d
-  getutline_r_unknown,
d8307d
-  pututline_unknown,
d8307d
-  endutent_unknown,
d8307d
-  NULL
d8307d
-};
d8307d
-
d8307d
-/* Currently selected backend.  */
d8307d
-const struct utfuncs *__libc_utmp_jump_table = &__libc_utmp_unknown_functions;
d8307d
-
d8307d
 /* We need to protect the opening of the file.  */
d8307d
 __libc_lock_define_initialized (, __libc_utmp_lock attribute_hidden)
d8307d
 
d8307d
 
d8307d
-static int
d8307d
-setutent_unknown (void)
d8307d
-{
d8307d
-  int result;
d8307d
-
d8307d
-  result = (*__libc_utmp_file_functions.setutent) ();
d8307d
-  if (result)
d8307d
-    __libc_utmp_jump_table = &__libc_utmp_file_functions;
d8307d
-
d8307d
-  return result;
d8307d
-}
d8307d
-
d8307d
-
d8307d
-static int
d8307d
-getutent_r_unknown (struct utmp *buffer, struct utmp **result)
d8307d
-{
d8307d
-  /* The backend was not yet initialized.  */
d8307d
-  if (setutent_unknown ())
d8307d
-    return (*__libc_utmp_jump_table->getutent_r) (buffer, result);
d8307d
-
d8307d
-  /* Not available.  */
d8307d
-  *result = NULL;
d8307d
-  return -1;
d8307d
-}
d8307d
-
d8307d
-
d8307d
-static int
d8307d
-getutid_r_unknown (const struct utmp *id, struct utmp *buffer,
d8307d
-		   struct utmp **result)
d8307d
-{
d8307d
-  /* The backend was not yet initialized.  */
d8307d
-  if (setutent_unknown ())
d8307d
-    return (*__libc_utmp_jump_table->getutid_r) (id, buffer, result);
d8307d
-
d8307d
-  /* Not available.  */
d8307d
-  *result = NULL;
d8307d
-  return -1;
d8307d
-}
d8307d
-
d8307d
-
d8307d
-static int
d8307d
-getutline_r_unknown (const struct utmp *line, struct utmp *buffer,
d8307d
-		     struct utmp **result)
d8307d
-{
d8307d
-  /* The backend was not yet initialized.  */
d8307d
-  if (setutent_unknown ())
d8307d
-    return (*__libc_utmp_jump_table->getutline_r) (line, buffer, result);
d8307d
-
d8307d
-  /* Not available.  */
d8307d
-  *result = NULL;
d8307d
-  return -1;
d8307d
-}
d8307d
-
d8307d
-
d8307d
-static struct utmp *
d8307d
-pututline_unknown (const struct utmp *data)
d8307d
-{
d8307d
-  /* The backend was not yet initialized.  */
d8307d
-  if (setutent_unknown ())
d8307d
-    return (*__libc_utmp_jump_table->pututline) (data);
d8307d
-
d8307d
-  /* Not available.  */
d8307d
-  return NULL;
d8307d
-}
d8307d
-
d8307d
-
d8307d
-static void
d8307d
-endutent_unknown (void)
d8307d
-{
d8307d
-  /* Nothing to do.  */
d8307d
-}
d8307d
-
d8307d
-
d8307d
 void
d8307d
 __setutent (void)
d8307d
 {
d8307d
   __libc_lock_lock (__libc_utmp_lock);
d8307d
 
d8307d
-  (*__libc_utmp_jump_table->setutent) ();
d8307d
+  __libc_setutent ();
d8307d
 
d8307d
   __libc_lock_unlock (__libc_utmp_lock);
d8307d
 }
d8307d
@@ -145,7 +46,7 @@ __getutent_r (struct utmp *buffer, struct utmp **result)
d8307d
 
d8307d
   __libc_lock_lock (__libc_utmp_lock);
d8307d
 
d8307d
-  retval = (*__libc_utmp_jump_table->getutent_r) (buffer, result);
d8307d
+  retval = __libc_getutent_r (buffer, result);
d8307d
 
d8307d
   __libc_lock_unlock (__libc_utmp_lock);
d8307d
 
d8307d
@@ -162,7 +63,7 @@ __pututline (const struct utmp *data)
d8307d
 
d8307d
   __libc_lock_lock (__libc_utmp_lock);
d8307d
 
d8307d
-  buffer = (*__libc_utmp_jump_table->pututline) (data);
d8307d
+  buffer = __libc_pututline (data);
d8307d
 
d8307d
   __libc_lock_unlock (__libc_utmp_lock);
d8307d
 
d8307d
@@ -177,8 +78,7 @@ __endutent (void)
d8307d
 {
d8307d
   __libc_lock_lock (__libc_utmp_lock);
d8307d
 
d8307d
-  (*__libc_utmp_jump_table->endutent) ();
d8307d
-  __libc_utmp_jump_table = &__libc_utmp_unknown_functions;
d8307d
+  __libc_endutent ();
d8307d
 
d8307d
   __libc_lock_unlock (__libc_utmp_lock);
d8307d
 }
d8307d
diff --git a/login/getutid_r.c b/login/getutid_r.c
d8307d
index b7d3dbac75774b0a..8cb6b16d735e8265 100644
d8307d
--- a/login/getutid_r.c
d8307d
+++ b/login/getutid_r.c
d8307d
@@ -49,7 +49,7 @@ __getutid_r (const struct utmp *id, struct utmp *buffer, struct utmp **result)
d8307d
 
d8307d
   __libc_lock_lock (__libc_utmp_lock);
d8307d
 
d8307d
-  retval = (*__libc_utmp_jump_table->getutid_r) (id, buffer, result);
d8307d
+  retval = __libc_getutid_r (id, buffer, result);
d8307d
 
d8307d
   __libc_lock_unlock (__libc_utmp_lock);
d8307d
 
d8307d
diff --git a/login/getutline_r.c b/login/getutline_r.c
d8307d
index 6996887f76b28816..5607c19ed2e1ca66 100644
d8307d
--- a/login/getutline_r.c
d8307d
+++ b/login/getutline_r.c
d8307d
@@ -36,7 +36,7 @@ __getutline_r (const struct utmp *line, struct utmp *buffer,
d8307d
 
d8307d
   __libc_lock_lock (__libc_utmp_lock);
d8307d
 
d8307d
-  retval = (*__libc_utmp_jump_table->getutline_r) (line, buffer, result);
d8307d
+  retval = __libc_getutline_r (line, buffer, result);
d8307d
 
d8307d
   __libc_lock_unlock (__libc_utmp_lock);
d8307d
 
d8307d
diff --git a/login/updwtmp.c b/login/updwtmp.c
d8307d
index 56fb41916a776c0a..7ae96224ca789b6d 100644
d8307d
--- a/login/updwtmp.c
d8307d
+++ b/login/updwtmp.c
d8307d
@@ -29,7 +29,7 @@ __updwtmp (const char *wtmp_file, const struct utmp *utmp)
d8307d
 {
d8307d
   const char *file_name = TRANSFORM_UTMP_FILE_NAME (wtmp_file);
d8307d
 
d8307d
-  (*__libc_utmp_file_functions.updwtmp) (file_name, utmp);
d8307d
+  __libc_updwtmp (file_name, utmp);
d8307d
 }
d8307d
 libc_hidden_def (__updwtmp)
d8307d
 weak_alias (__updwtmp, updwtmp)
d8307d
diff --git a/login/utmp-private.h b/login/utmp-private.h
d8307d
index bd8773984cfc56de..5c2048ee52dc3cee 100644
d8307d
--- a/login/utmp-private.h
d8307d
+++ b/login/utmp-private.h
d8307d
@@ -24,24 +24,17 @@
d8307d
 #include <utmp.h>
d8307d
 #include <libc-lock.h>
d8307d
 
d8307d
-/* The structure describing the functions in a backend.  */
d8307d
-struct utfuncs
d8307d
-{
d8307d
-  int (*setutent) (void);
d8307d
-  int (*getutent_r) (struct utmp *, struct utmp **);
d8307d
-  int (*getutid_r) (const struct utmp *, struct utmp *, struct utmp **);
d8307d
-  int (*getutline_r) (const struct utmp *, struct utmp *, struct utmp **);
d8307d
-  struct utmp *(*pututline) (const struct utmp *);
d8307d
-  void (*endutent) (void);
d8307d
-  int (*updwtmp) (const char *, const struct utmp *);
d8307d
-};
d8307d
-
d8307d
-/* The tables from the services.  */
d8307d
-extern const struct utfuncs __libc_utmp_file_functions attribute_hidden;
d8307d
-extern const struct utfuncs __libc_utmp_unknown_functions attribute_hidden;
d8307d
-
d8307d
-/* Currently selected backend.  */
d8307d
-extern const struct utfuncs *__libc_utmp_jump_table attribute_hidden;
d8307d
+/* These functions check for initialization, but not perform any
d8307d
+   locking.  */
d8307d
+int __libc_setutent (void) attribute_hidden;
d8307d
+int __libc_getutent_r (struct utmp *, struct utmp **) attribute_hidden;
d8307d
+int __libc_getutid_r (const struct utmp *, struct utmp *, struct utmp **)
d8307d
+  attribute_hidden;
d8307d
+int __libc_getutline_r (const struct utmp *, struct utmp *, struct utmp **)
d8307d
+  attribute_hidden;
d8307d
+struct utmp *__libc_pututline (const struct utmp *) attribute_hidden;
d8307d
+void __libc_endutent (void) attribute_hidden;
d8307d
+int __libc_updwtmp (const char *, const struct utmp *) attribute_hidden;
d8307d
 
d8307d
 /* Current file name.  */
d8307d
 extern const char *__libc_utmp_file_name attribute_hidden;
d8307d
diff --git a/login/utmp_file.c b/login/utmp_file.c
d8307d
index 040a5057116bb69d..069e6d0452e333ad 100644
d8307d
--- a/login/utmp_file.c
d8307d
+++ b/login/utmp_file.c
d8307d
@@ -105,37 +105,12 @@ static void timeout_handler (int signum) {};
d8307d
     alarm (old_timeout);						      \
d8307d
 } while (0)
d8307d
 
d8307d
-
d8307d
-/* Functions defined here.  */
d8307d
-static int setutent_file (void);
d8307d
-static int getutent_r_file (struct utmp *buffer, struct utmp **result);
d8307d
-static int getutid_r_file (const struct utmp *key, struct utmp *buffer,
d8307d
-			   struct utmp **result);
d8307d
-static int getutline_r_file (const struct utmp *key, struct utmp *buffer,
d8307d
-			     struct utmp **result);
d8307d
-static struct utmp *pututline_file (const struct utmp *data);
d8307d
-static void endutent_file (void);
d8307d
-static int updwtmp_file (const char *file, const struct utmp *utmp);
d8307d
-
d8307d
-/* Jump table for file functions.  */
d8307d
-const struct utfuncs __libc_utmp_file_functions =
d8307d
-{
d8307d
-  setutent_file,
d8307d
-  getutent_r_file,
d8307d
-  getutid_r_file,
d8307d
-  getutline_r_file,
d8307d
-  pututline_file,
d8307d
-  endutent_file,
d8307d
-  updwtmp_file
d8307d
-};
d8307d
-
d8307d
-
d8307d
 #ifndef TRANSFORM_UTMP_FILE_NAME
d8307d
 # define TRANSFORM_UTMP_FILE_NAME(file_name) (file_name)
d8307d
 #endif
d8307d
 
d8307d
-static int
d8307d
-setutent_file (void)
d8307d
+int
d8307d
+__libc_setutent (void)
d8307d
 {
d8307d
   if (file_fd < 0)
d8307d
     {
d8307d
@@ -166,15 +141,19 @@ setutent_file (void)
d8307d
   return 1;
d8307d
 }
d8307d
 
d8307d
+/* Preform initialization if necessary.  */
d8307d
+static bool
d8307d
+maybe_setutent (void)
d8307d
+{
d8307d
+  return file_fd >= 0 || __libc_setutent ();
d8307d
+}
d8307d
 
d8307d
-static int
d8307d
-getutent_r_file (struct utmp *buffer, struct utmp **result)
d8307d
+int
d8307d
+__libc_getutent_r (struct utmp *buffer, struct utmp **result)
d8307d
 {
d8307d
   ssize_t nbytes;
d8307d
 
d8307d
-  assert (file_fd >= 0);
d8307d
-
d8307d
-  if (file_offset == -1l)
d8307d
+  if (!maybe_setutent () || file_offset == -1l)
d8307d
     {
d8307d
       /* Not available.  */
d8307d
       *result = NULL;
d8307d
@@ -279,13 +258,11 @@ unlock_return:
d8307d
 
d8307d
 /* For implementing this function we don't use the getutent_r function
d8307d
    because we can avoid the reposition on every new entry this way.  */
d8307d
-static int
d8307d
-getutid_r_file (const struct utmp *id, struct utmp *buffer,
d8307d
-		struct utmp **result)
d8307d
+int
d8307d
+__libc_getutid_r (const struct utmp *id, struct utmp *buffer,
d8307d
+		  struct utmp **result)
d8307d
 {
d8307d
-  assert (file_fd >= 0);
d8307d
-
d8307d
-  if (file_offset == -1l)
d8307d
+  if (!maybe_setutent () || file_offset == -1l)
d8307d
     {
d8307d
       *result = NULL;
d8307d
       return -1;
d8307d
@@ -309,13 +286,11 @@ getutid_r_file (const struct utmp *id, struct utmp *buffer,
d8307d
 
d8307d
 /* For implementing this function we don't use the getutent_r function
d8307d
    because we can avoid the reposition on every new entry this way.  */
d8307d
-static int
d8307d
-getutline_r_file (const struct utmp *line, struct utmp *buffer,
d8307d
-		  struct utmp **result)
d8307d
+int
d8307d
+__libc_getutline_r (const struct utmp *line, struct utmp *buffer,
d8307d
+		    struct utmp **result)
d8307d
 {
d8307d
-  assert (file_fd >= 0);
d8307d
-
d8307d
-  if (file_offset == -1l)
d8307d
+  if (!maybe_setutent () || file_offset == -1l)
d8307d
     {
d8307d
       *result = NULL;
d8307d
       return -1;
d8307d
@@ -361,15 +336,16 @@ unlock_return:
d8307d
 }
d8307d
 
d8307d
 
d8307d
-static struct utmp *
d8307d
-pututline_file (const struct utmp *data)
d8307d
+struct utmp *
d8307d
+__libc_pututline (const struct utmp *data)
d8307d
 {
d8307d
+  if (!maybe_setutent ())
d8307d
+    return NULL;
d8307d
+
d8307d
   struct utmp buffer;
d8307d
   struct utmp *pbuf;
d8307d
   int found;
d8307d
 
d8307d
-  assert (file_fd >= 0);
d8307d
-
d8307d
   if (! file_writable)
d8307d
     {
d8307d
       /* We must make the file descriptor writable before going on.  */
d8307d
@@ -467,18 +443,19 @@ pututline_file (const struct utmp *data)
d8307d
 }
d8307d
 
d8307d
 
d8307d
-static void
d8307d
-endutent_file (void)
d8307d
+void
d8307d
+__libc_endutent (void)
d8307d
 {
d8307d
-  assert (file_fd >= 0);
d8307d
-
d8307d
-  __close_nocancel_nostatus (file_fd);
d8307d
-  file_fd = -1;
d8307d
+  if (file_fd >= 0)
d8307d
+    {
d8307d
+      __close_nocancel_nostatus (file_fd);
d8307d
+      file_fd = -1;
d8307d
+    }
d8307d
 }
d8307d
 
d8307d
 
d8307d
-static int
d8307d
-updwtmp_file (const char *file, const struct utmp *utmp)
d8307d
+int
d8307d
+__libc_updwtmp (const char *file, const struct utmp *utmp)
d8307d
 {
d8307d
   int result = -1;
d8307d
   off64_t offset;
d8307d
diff --git a/login/utmpname.c b/login/utmpname.c
d8307d
index 21cb890a1a2fdc92..73b19c33ceab4dd7 100644
d8307d
--- a/login/utmpname.c
d8307d
+++ b/login/utmpname.c
d8307d
@@ -42,8 +42,7 @@ __utmpname (const char *file)
d8307d
   __libc_lock_lock (__libc_utmp_lock);
d8307d
 
d8307d
   /* Close the old file.  */
d8307d
-  (*__libc_utmp_jump_table->endutent) ();
d8307d
-  __libc_utmp_jump_table = &__libc_utmp_unknown_functions;
d8307d
+  __libc_endutent ();
d8307d
 
d8307d
   if (strcmp (file, __libc_utmp_file_name) != 0)
d8307d
     {
d8307d
diff --git a/manual/users.texi b/manual/users.texi
d8307d
index 4ed79ba26fc8e9d0..a006bb58acfd0568 100644
d8307d
--- a/manual/users.texi
d8307d
+++ b/manual/users.texi
d8307d
@@ -894,9 +894,9 @@ The @code{getlogin} function is declared in @file{unistd.h}, while
d8307d
 @c   ttyname_r dup @ascuheap @acsmem @acsfd
d8307d
 @c   strncpy dup ok
d8307d
 @c   libc_lock_lock dup @asulock @aculock
d8307d
-@c   *libc_utmp_jump_table->setutent dup @mtasurace:utent @acsfd
d8307d
-@c   *libc_utmp_jump_table->getutline_r dup @mtasurace:utent @mtascusig:ALRM @mtascutimer
d8307d
-@c   *libc_utmp_jump_table->endutent dup @mtasurace:utent @asulock @aculock
d8307d
+@c   __libc_setutent dup @mtasurace:utent @acsfd
d8307d
+@c   __libc_getutline_r dup @mtasurace:utent @mtascusig:ALRM @mtascutimer
d8307d
+@c   __libc_endutent dup @mtasurace:utent @asulock @aculock
d8307d
 @c   libc_lock_unlock dup ok
d8307d
 @c   strlen dup ok
d8307d
 @c   memcpy dup ok
d8307d
@@ -1111,7 +1111,7 @@ compatibility only, @file{utmp.h} defines @code{ut_time} as an alias for
d8307d
 
d8307d
 @c setutent @mtasurace:utent @asulock @aculock @acsfd
d8307d
 @c  libc_lock_lock dup @asulock @aculock
d8307d
-@c  *libc_utmp_jump_table->setutent @mtasurace:utent @acsfd
d8307d
+@c  __libc_setutent @mtasurace:utent @acsfd
d8307d
 @c   setutent_unknown @mtasurace:utent @acsfd
d8307d
 @c    *libc_utmp_file_functions.setutent = setutent_file @mtasurace:utent @acsfd
d8307d
 @c      open_not_cancel_2 dup @acsfd
d8307d
@@ -1152,7 +1152,7 @@ A null pointer is returned in case no further entry is available.
d8307d
 @safety{@prelim{}@mtunsafe{@mtasurace{:utent}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
d8307d
 @c endutent @mtasurace:utent @asulock @aculock @acsfd
d8307d
 @c  libc_lock_lock dup @asulock @aculock
d8307d
-@c  *libc_utmp_jump_table->endutent @mtasurace:utent @acsfd
d8307d
+@c  __libc_endutent @mtasurace:utent @acsfd
d8307d
 @c   endutent_unknown ok
d8307d
 @c   endutent_file @mtasurace:utent @acsfd
d8307d
 @c    close_not_cancel_no_status dup @acsfd
d8307d
@@ -1230,7 +1230,7 @@ over again.
d8307d
 @safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
d8307d
 @c pututline @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
d8307d
 @c  libc_lock_lock dup @asulock @aculock
d8307d
-@c  *libc_utmp_jump_table->pututline @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
d8307d
+@c  __libc_pututline @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
d8307d
 @c   pututline_unknown @mtasurace:utent @acsfd
d8307d
 @c    setutent_unknown dup @mtasurace:utent @acsfd
d8307d
 @c   pututline_file @mtascusig:ALRM @mtascutimer @acsfd
d8307d
@@ -1282,7 +1282,7 @@ user-provided buffer.
d8307d
 @safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
d8307d
 @c getutent_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
d8307d
 @c  libc_lock_lock dup @asulock @aculock
d8307d
-@c  *libc_utmp_jump_table->getutent_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
d8307d
+@c  __libc_getutent_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
d8307d
 @c   getutent_r_unknown @mtasurace:utent @acsfd
d8307d
 @c    setutent_unknown dup @mtasurace:utent @acsfd
d8307d
 @c   getutent_r_file @mtasurace:utent @mtascusig:ALRM @mtascutimer
d8307d
@@ -1319,7 +1319,7 @@ This function is a GNU extension.
d8307d
 @safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
d8307d
 @c getutid_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
d8307d
 @c  libc_lock_lock dup @asulock @aculock
d8307d
-@c  *libc_utmp_jump_table->getutid_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
d8307d
+@c  __libc_getutid_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
d8307d
 @c   getutid_r_unknown @mtasurace:utent @acsfd
d8307d
 @c    setutent_unknown dup @mtasurace:utent @acsfd
d8307d
 @c   getutid_r_file @mtascusig:ALRM @mtascutimer
d8307d
@@ -1349,7 +1349,7 @@ This function is a GNU extension.
d8307d
 @safety{@prelim{}@mtunsafe{@mtasurace{:utent} @mtascusig{:ALRM} @mtascutimer{}}@asunsafe{@asulock{}}@acunsafe{@aculock{} @acsfd{}}}
d8307d
 @c getutline_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @asulock @aculock @acsfd
d8307d
 @c  libc_lock_lock dup @asulock @aculock
d8307d
-@c  *libc_utmp_jump_table->getutline_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
d8307d
+@c  __libc_getutline_r @mtasurace:utent @mtascusig:ALRM @mtascutimer @acsfd
d8307d
 @c   getutline_r_unknown @mtasurace:utent @acsfd
d8307d
 @c    setutent_unknown dup @mtasurace:utent @acsfd
d8307d
 @c   getutline_r_file @mtasurace:utent @mtascusig:ALRM @mtascutimer
d8307d
@@ -1393,7 +1393,7 @@ be used.
d8307d
 @safety{@prelim{}@mtunsafe{@mtasurace{:utent}}@asunsafe{@asulock{} @ascuheap{}}@acunsafe{@aculock{} @acsmem{}}}
d8307d
 @c utmpname @mtasurace:utent @asulock @ascuheap @aculock @acsmem
d8307d
 @c  libc_lock_lock dup @asulock @aculock
d8307d
-@c  *libc_utmp_jump_table->endutent dup @mtasurace:utent
d8307d
+@c  __libc_endutent dup @mtasurace:utent
d8307d
 @c  strcmp dup ok
d8307d
 @c  free dup @ascuheap @acsmem
d8307d
 @c  strdup dup @ascuheap @acsmem
d8307d
diff --git a/sysdeps/unix/getlogin_r.c b/sysdeps/unix/getlogin_r.c
d8307d
index 444df7e4d3210cf6..180c0bbca13d0f87 100644
d8307d
--- a/sysdeps/unix/getlogin_r.c
d8307d
+++ b/sysdeps/unix/getlogin_r.c
d8307d
@@ -64,8 +64,8 @@ __getlogin_r (char *name, size_t name_len)
d8307d
      held so that our search is thread-safe.  */
d8307d
 
d8307d
   __libc_lock_lock (__libc_utmp_lock);
d8307d
-  (*__libc_utmp_jump_table->setutent) ();
d8307d
-  result = (*__libc_utmp_jump_table->getutline_r) (&line, &buffer, &ut);
d8307d
+  __libc_setutent ();
d8307d
+  result = __libc_getutline_r (&line, &buffer, &ut);
d8307d
   if (result < 0)
d8307d
     {
d8307d
       if (errno == ESRCH)
d8307d
@@ -74,8 +74,7 @@ __getlogin_r (char *name, size_t name_len)
d8307d
       else
d8307d
 	result = errno;
d8307d
     }
d8307d
-  (*__libc_utmp_jump_table->endutent) ();
d8307d
-  __libc_utmp_jump_table = &__libc_utmp_unknown_functions;
d8307d
+  __libc_endutent ();
d8307d
   __libc_lock_unlock (__libc_utmp_lock);
d8307d
 
d8307d
   if (result == 0)