mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-08 14:20:07 +00:00
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.
This commit is contained in:
parent
f23a86baf7
commit
62470f605e
@ -1,3 +1,11 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
2012-04-06 Robert Millan <rmh@gnu.org>
|
2012-04-06 Robert Millan <rmh@gnu.org>
|
||||||
|
|
||||||
[BZ #6486]
|
[BZ #6486]
|
||||||
|
@ -75,6 +75,8 @@ libnss_db-inhibit-o = $(filter-out .os,$(object-suffixes))
|
|||||||
ifeq ($(build-static-nss),yes)
|
ifeq ($(build-static-nss),yes)
|
||||||
routines += $(libnss_files-routines)
|
routines += $(libnss_files-routines)
|
||||||
static-only-routines += $(libnss_files-routines)
|
static-only-routines += $(libnss_files-routines)
|
||||||
|
tests-static = tst-nss-static
|
||||||
|
tests += $(tests-static)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996-1999,2001-2007,2009,2010,2011
|
/* Copyright (C) 1996-2012
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
@ -315,7 +315,7 @@ nss_load_library (service_user *ni)
|
|||||||
if (ni->library->lib_handle == NULL)
|
if (ni->library->lib_handle == NULL)
|
||||||
{
|
{
|
||||||
/* Load the shared library. */
|
/* 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);
|
+ strlen (__nss_shlib_revision) + 1);
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
char shlib_name[shlen];
|
char shlib_name[shlen];
|
||||||
@ -323,7 +323,7 @@ nss_load_library (service_user *ni)
|
|||||||
/* Construct shared object name. */
|
/* Construct shared object name. */
|
||||||
__stpcpy (__stpcpy (__stpcpy (__stpcpy (shlib_name,
|
__stpcpy (__stpcpy (__stpcpy (__stpcpy (shlib_name,
|
||||||
"libnss_"),
|
"libnss_"),
|
||||||
ni->library->name),
|
ni->name),
|
||||||
".so"),
|
".so"),
|
||||||
__nss_shlib_revision);
|
__nss_shlib_revision);
|
||||||
|
|
||||||
@ -337,14 +337,14 @@ nss_load_library (service_user *ni)
|
|||||||
else if (is_nscd)
|
else if (is_nscd)
|
||||||
{
|
{
|
||||||
/* Call the init function when nscd is used. */
|
/* 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);
|
+ strlen ("_init") + 1);
|
||||||
char init_name[initlen];
|
char init_name[initlen];
|
||||||
|
|
||||||
/* Construct the init function name. */
|
/* Construct the init function name. */
|
||||||
__stpcpy (__stpcpy (__stpcpy (init_name,
|
__stpcpy (__stpcpy (__stpcpy (init_name,
|
||||||
"_nss_"),
|
"_nss_"),
|
||||||
ni->library->name),
|
ni->name),
|
||||||
"_init");
|
"_init");
|
||||||
|
|
||||||
/* Find the optional init function. */
|
/* Find the optional init function. */
|
||||||
@ -428,13 +428,13 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Get the desired function. */
|
/* 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);
|
+ strlen (fct_name) + 1);
|
||||||
char name[namlen];
|
char name[namlen];
|
||||||
|
|
||||||
/* Construct the function name. */
|
/* Construct the function name. */
|
||||||
__stpcpy (__stpcpy (__stpcpy (__stpcpy (name, "_nss_"),
|
__stpcpy (__stpcpy (__stpcpy (__stpcpy (name, "_nss_"),
|
||||||
ni->library->name),
|
ni->name),
|
||||||
"_"),
|
"_"),
|
||||||
fct_name);
|
fct_name);
|
||||||
|
|
||||||
@ -457,12 +457,12 @@ __nss_lookup_function (service_user *ni, const char *fct_name)
|
|||||||
# include "function.def"
|
# include "function.def"
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
size_t namlen = (5 + strlen (ni->library->name) + 1
|
size_t namlen = (5 + strlen (ni->name) + 1
|
||||||
+ strlen (fct_name) + 1);
|
+ strlen (fct_name) + 1);
|
||||||
char name[namlen];
|
char name[namlen];
|
||||||
|
|
||||||
/* Construct the function name. */
|
/* Construct the function name. */
|
||||||
__stpcpy (__stpcpy (__stpcpy (name, ni->library->name),
|
__stpcpy (__stpcpy (__stpcpy (name, ni->name),
|
||||||
"_"),
|
"_"),
|
||||||
fct_name);
|
fct_name);
|
||||||
|
|
||||||
|
15
nss/tst-nss-static.c
Normal file
15
nss/tst-nss-static.c
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/* glibc test for static NSS. */
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#define TEST_FUNCTION do_test ()
|
||||||
|
static int
|
||||||
|
do_test (void)
|
||||||
|
{
|
||||||
|
struct passwd *pw;
|
||||||
|
|
||||||
|
pw = getpwuid(0);
|
||||||
|
return pw == NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include "../test-skeleton.c"
|
Loading…
Reference in New Issue
Block a user