_dl_init_paths (void)
_dl_init_paths (const char *llp)
_dl_init_paths (void){  static const char *trusted_dirs[] =  {#include "trusted-dirs.h"    NULL  };  struct r_search_path_elem **pelem;  /* We have in `search_path' the information about the RPATH of the     dynamic loader.  Now fill in the information about the applications     RPATH and the directories addressed by the LD_LIBRARY_PATH environment     variable.  */  struct link_map *l;  /* First determine how many elements the LD_LIBRARY_PATH contents has.  */  const char *llp = getenv ("LD_LIBRARY_PATH");  size_t nllp;  if (llp != NULL && *llp != '\0')    {      /* Simply count the number of colons.  */      const char *cp = llp;      nllp = 1;      while (*cp)	if (*cp++ == ':')	  ++nllp;    }  else    nllp = 0;  l = _dl_loaded;  if (l != NULL)    {      if (l->l_type != lt_loaded && l->l_info[DT_RPATH])	{	  /* Allocate room for the search path and fill in information	     from RPATH.  */	  l->l_rpath_dirs =	    decompose_rpath ((const char *)			     (l->l_addr + l->l_info[DT_STRTAB]->d_un.d_ptr			      + l->l_info[DT_RPATH]->d_un.d_val),			     nllp);	}      else	{	  /* If we have no LD_LIBRARY_PATH and no RPATH we must tell	     this somehow to prevent we look this up again and again.  */	  if (nllp == 0)	    l->l_rpath_dirs = (struct r_search_path_elem **) -1l;	  else	    {	      l->l_rpath_dirs = (struct r_search_path_elem **)		malloc ((nllp + 1) * sizeof (*l->l_rpath_dirs));	      if (l->l_rpath_dirs == NULL)		_dl_signal_error (ENOMEM, NULL,				  "cannot create cache for search path");	      l->l_rpath_dirs[0] = NULL;	    }	}      /* We don't need to search the list of fake entries which is searched	 when no dynamic objects were loaded at this time.  */      fake_path_list = NULL;      if (nllp > 0)	{	  char *copy = strdupa (llp);	  /* Decompose the LD_LIBRARY_PATH and fill in the result.	     First search for the next place to enter elements.  */	  struct r_search_path_elem **result = l->l_rpath_dirs;	  while (*result != NULL)	    ++result;	  /* We need to take care that the LD_LIBRARY_PATH environment	     variable can contain a semicolon.  */	  (void) fillin_rpath (copy, result, ":;",			       __libc_enable_secure ? trusted_dirs : NULL);	}    }  else    {      /* This is a statically linked program but we still have to	 take care for the LD_LIBRARY_PATH environment variable.  We	 use a fake link_map entry.  This will only contain the	 l_rpath_dirs information.  */      if (nllp == 0)	fake_path_list = NULL;      else	{	  fake_path_list = (struct r_search_path_elem **)	    malloc ((nllp + 1) * sizeof (struct r_search_path_elem *));	  if (fake_path_list == NULL)	    _dl_signal_error (ENOMEM, NULL,			      "cannot create cache for search path");	  (void) fillin_rpath (local_strdup (llp), fake_path_list, ":;",			       __libc_enable_secure ? trusted_dirs : NULL);	}    }  /* Now set up the rest of the rtld_search_dirs.  */  for (pelem = rtld_search_dirs; *pelem != NULL; ++pelem)    {      struct r_search_path_elem *relem = *pelem;      if (_dl_platform != NULL)	{	  char *tmp, *orig;	  relem->machdirnamelen = relem->dirnamelen + _dl_platformlen + 1;	  tmp = (char *) malloc (relem->machdirnamelen + 1);	  if (tmp == NULL)	    _dl_signal_error (ENOMEM, NULL,			      "cannot create cache for search path");	  orig = tmp;	  tmp = __mempcpy (tmp, relem->dirname, relem->dirnamelen);	  tmp = __mempcpy (tmp, _dl_platform, _dl_platformlen);	  *tmp++ = '/';	  *tmp = '\0';	  relem->dirname = orig;	  relem->machdirstatus = unknown;	  if (max_dirnamelen < relem->machdirnamelen)	    max_dirnamelen = relem->machdirnamelen;	}      else	{	  relem->machdirnamelen = relem->dirnamelen;	  relem->machdirstatus = nonexisting;	  if (max_dirnamelen < relem->dirnamelen)	    max_dirnamelen = relem->dirnamelen;	}    }}