]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Rewrite to use jump table correctly.
authorUlrich Drepper <drepper@redhat.com>
Sat, 16 Aug 1997 19:38:35 +0000 (19:38 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 16 Aug 1997 19:38:35 +0000 (19:38 +0000)
login/getutid_r.c

index 52b83cd8627c43a0b5caf77e59a2f679e876c699..d70e94cc171846b9312b4d1e059de2602a3130e9 100644 (file)
@@ -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>
    and Paul Janzen <pcj@primenet.com>, 1996.
@@ -20,8 +20,6 @@
 
 #include <errno.h>
 #include <libc-lock.h>
-#include <string.h>
-#include <unistd.h>
 #include <utmp.h>
 
 #include "utmp-private.h"
@@ -38,7 +36,7 @@ int
 __getutid_r (const struct utmp *id, struct utmp *buffer, struct utmp **result)
 {
 #if (_HAVE_UT_ID - 0) && (_HAVE_UT_TYPE - 0)
-  int retval = -1;
+  int retval;
 
   /* Test whether ID has any of the legal types.  */
   if (id->ut_type != RUN_LVL && id->ut_type != BOOT_TIME
@@ -54,11 +52,7 @@ __getutid_r (const struct utmp *id, struct utmp *buffer, struct utmp **result)
 
   __libc_lock_lock (__libc_utmp_lock);
 
-  /* Not yet initialized.  */
-  if ((*__libc_utmp_jump_table->setutent) (0))
-    retval = (*__libc_utmp_jump_table->getutid_r) (id, buffer, result);
-  else
-    *result = NULL;
+  retval = (*__libc_utmp_jump_table->getutid_r) (id, buffer, result);
 
   __libc_lock_unlock (__libc_utmp_lock);