summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Pluzhnikov <ppluzhnikov@google.com>2012-04-06 13:49:35 -0700
committerPaul Pluzhnikov <ppluzhnikov@google.com>2012-04-06 13:49:35 -0700
commit62470f605ed931f88fb1993f4440d5bb02afa2b1 (patch)
tree5a52238f0bbc400ec5d72ebc2f0493cd9dbbc549 /nss/nsswitch.c
parentFix ascending ordering of bug numbers in NEWS. (diff)
downloadglibc-62470f605ed931f88fb1993f4440d5bb02afa2b1.tar.gz
glibc-62470f605ed931f88fb1993f4440d5bb02afa2b1.tar.bz2
glibc-62470f605ed931f88fb1993f4440d5bb02afa2b1.zip
2012-04-06 Paul Pluzhnikov <ppluzhnikov@google.com>
[BZ #13895] * nss/nsswitch.c (nss_load_library, __nss_lookup_function): Avoid extra indirection. * nss/Makefile (tests-static, tests): Add tst-nss-static. * nss/tst-nss-static.c: New.
Diffstat (limited to 'nss/nsswitch.c')
-rw-r--r--nss/nsswitch.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 7acb1403fd..53ff5f8f71 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-1999,2001-2007,2009,2010,2011
+/* Copyright (C) 1996-2012
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -315,7 +315,7 @@ nss_load_library (service_user *ni)
if (ni->library->lib_handle == NULL)
{
/* Load the shared library. */
- size_t shlen = (7 + strlen (ni->library->name) + 3
+ size_t shlen = (7 + strlen (ni->name) + 3
+ strlen (__nss_shlib_revision) + 1);
int saved_errno = errno;
char shlib_name[shlen];
@@ -323,7 +323,7 @@ nss_load_library (service_user *ni)
/* Construct shared object name. */
__stpcpy (__stpcpy (__stpcpy (__stpcpy (shlib_name,
"libnss_"),
- ni->library->name),
+ ni->name),
".so"),
__nss_shlib_revision);
@@ -337,14 +337,14 @@ nss_load_library (service_user *ni)
else if (is_nscd)
{
/* Call the init function when nscd is used. */
- size_t initlen = (5 + strlen (ni->library->name)
+ size_t initlen = (5 + strlen (ni->name)
+ strlen ("_init") + 1);
char init_name[initlen];
/* Construct the init function name. */
__stpcpy (__stpcpy (__stpcpy (init_name,
"_nss_"),
- ni->library->name),
+ ni->name),
"_init");
/* Find the optional init function. */
@@ -428,13 +428,13 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
else
{
/* Get the desired function. */
- size_t namlen = (5 + strlen (ni->library->name) + 1
+ size_t namlen = (5 + strlen (ni->name) + 1
+ strlen (fct_name) + 1);
char name[namlen];
/* Construct the function name. */
__stpcpy (__stpcpy (__stpcpy (__stpcpy (name, "_nss_"),
- ni->library->name),
+ ni->name),
"_"),
fct_name);
@@ -457,12 +457,12 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
# include "function.def"
{ NULL, NULL }
};
- size_t namlen = (5 + strlen (ni->library->name) + 1
+ size_t namlen = (5 + strlen (ni->name) + 1
+ strlen (fct_name) + 1);
char name[namlen];
/* Construct the function name. */
- __stpcpy (__stpcpy (__stpcpy (name, ni->library->name),
+ __stpcpy (__stpcpy (__stpcpy (name, ni->name),
"_"),
fct_name);