summaryrefslogtreecommitdiff
path: root/elf/ldconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/ldconfig.c')
-rw-r--r--elf/ldconfig.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index b4af31e5b5..d4176d1220 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1031,17 +1031,19 @@ search_dirs (void)
static void parse_conf_include (const char *config_file, unsigned int lineno,
- bool do_chroot, const char *pattern);
+ const char *prefix, bool do_chroot,
+ const char *pattern);
/* Parse configuration file. */
static void
-parse_conf (const char *filename, bool do_chroot)
+parse_conf (const char *filename, const char *prefix, bool do_chroot)
{
FILE *file = NULL;
char *line = NULL;
const char *canon;
size_t len = 0;
unsigned int lineno;
+ size_t prefix_len = prefix ? strlen (prefix) : 0;
if (do_chroot && opt_chroot)
{
@@ -1102,7 +1104,14 @@ parse_conf (const char *filename, bool do_chroot)
cp += 8;
while ((dir = strsep (&cp, " \t")) != NULL)
if (dir[0] != '\0')
- parse_conf_include (filename, lineno, do_chroot, dir);
+ parse_conf_include (filename, lineno, prefix, do_chroot, dir);
+ }
+ else if (prefix != NULL)
+ {
+ size_t cp_len = strlen (cp);
+ char new_cp [prefix_len + cp_len + 1];
+ memcpy (mempcpy (new_cp, prefix, prefix_len), cp, cp_len + 1);
+ add_dir (new_cp);
}
else if (!strncasecmp (cp, "hwcap", 5) && isblank (cp[5]))
{
@@ -1165,7 +1174,7 @@ parse_conf (const char *filename, bool do_chroot)
config files to read. */
static void
parse_conf_include (const char *config_file, unsigned int lineno,
- bool do_chroot, const char *pattern)
+ const char *prefix, bool do_chroot, const char *pattern)
{
if (opt_chroot && pattern[0] != '/')
error (EXIT_FAILURE, 0,
@@ -1197,7 +1206,7 @@ parse_conf_include (const char *config_file, unsigned int lineno,
{
case 0:
for (size_t i = 0; i < gl.gl_pathc; ++i)
- parse_conf (gl.gl_pathv[i], false);
+ parse_conf (gl.gl_pathv[i], prefix, false);
globfree64 (&gl);
break;
@@ -1240,6 +1249,8 @@ main (int argc, char **argv)
/* Set the text message domain. */
textdomain (_libc_intl_domainname);
+ arch_startup (argc, argv);
+
/* Parse and process arguments. */
int remaining;
argp_parse (&argp, argc, argv, 0, &remaining, NULL);
@@ -1349,12 +1360,14 @@ main (int argc, char **argv)
if (!opt_only_cline)
{
- parse_conf (config_file, true);
+ parse_conf (config_file, NULL, true);
/* Always add the standard search paths. */
add_system_dir (SLIBDIR);
if (strcmp (SLIBDIR, LIBDIR))
add_system_dir (LIBDIR);
+
+ add_arch_dirs (config_file);
}
const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE;