summaryrefslogtreecommitdiff
path: root/elf/ldconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/ldconfig.c')
-rw-r--r--elf/ldconfig.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 9c6f2ba791..fbdd814edf 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1999.
@@ -100,7 +100,8 @@ int opt_format = 1;
/* Build cache. */
static int opt_build_cache = 1;
-/* Generate links. */
+/* Enable symbolic link processing. If set, create or update symbolic
+ links, and remove stale symbolic links. */
static int opt_link = 1;
/* Only process directories specified on the command line. */
@@ -141,7 +142,7 @@ static const struct argp_option options[] =
{ "print-cache", 'p', NULL, 0, N_("Print cache"), 0},
{ "verbose", 'v', NULL, 0, N_("Generate verbose messages"), 0},
{ NULL, 'N', NULL, 0, N_("Don't build cache"), 0},
- { NULL, 'X', NULL, 0, N_("Don't generate links"), 0},
+ { NULL, 'X', NULL, 0, N_("Don't update symbolic links"), 0},
{ NULL, 'r', N_("ROOT"), 0, N_("Change to and use ROOT as root directory"), 0},
{ NULL, 'C', N_("CACHE"), 0, N_("Use CACHE as cache file"), 0},
{ NULL, 'f', N_("CONF"), 0, N_("Use CONF as configuration file"), 0},
@@ -324,7 +325,7 @@ print_version (FILE *stream, struct argp_state *state)
Copyright (C) %s Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions. There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2016");
+"), "2018");
fprintf (stream, gettext ("Written by %s.\n"),
"Andreas Jaeger");
}
@@ -709,25 +710,20 @@ search_dir (const struct dir_entry *entry)
while ((direntry = readdir64 (dir)) != NULL)
{
int flag;
-#ifdef _DIRENT_HAVE_D_TYPE
/* We only look at links and regular files. */
if (direntry->d_type != DT_UNKNOWN
&& direntry->d_type != DT_LNK
&& direntry->d_type != DT_REG
&& direntry->d_type != DT_DIR)
continue;
-#endif /* _DIRENT_HAVE_D_TYPE */
/* Does this file look like a shared library or is it a hwcap
subdirectory? The dynamic linker is also considered as
shared library. */
if (((strncmp (direntry->d_name, "lib", 3) != 0
&& strncmp (direntry->d_name, "ld-", 3) != 0)
|| strstr (direntry->d_name, ".so") == NULL)
- && (
-#ifdef _DIRENT_HAVE_D_TYPE
- direntry->d_type == DT_REG ||
-#endif
- !is_hwcap_platform (direntry->d_name)))
+ && (direntry->d_type == DT_REG
+ || !is_hwcap_platform (direntry->d_name)))
continue;
size_t len = strlen (direntry->d_name);
@@ -764,12 +760,10 @@ search_dir (const struct dir_entry *entry)
}
struct stat64 lstat_buf;
-#ifdef _DIRENT_HAVE_D_TYPE
/* We optimize and try to do the lstat call only if needed. */
if (direntry->d_type != DT_UNKNOWN)
lstat_buf.st_mode = DTTOIF (direntry->d_type);
else
-#endif
if (__glibc_unlikely (lstat64 (real_file_name, &lstat_buf)))
{
error (0, errno, _("Cannot lstat %s"), file_name);
@@ -800,7 +794,7 @@ search_dir (const struct dir_entry *entry)
error (0, errno, _("Cannot stat %s"), file_name);
/* Remove stale symlinks. */
- if (strstr (direntry->d_name, ".so."))
+ if (opt_link && strstr (direntry->d_name, ".so."))
unlink (real_file_name);
continue;
}
@@ -824,9 +818,6 @@ search_dir (const struct dir_entry *entry)
new_entry->path = xstrdup (file_name);
new_entry->flag = entry->flag;
new_entry->next = NULL;
-#ifdef _DIRENT_HAVE_D_TYPE
- /* We have filled in lstat only #ifndef
- _DIRENT_HAVE_D_TYPE. Fill it in if needed. */
if (!is_link
&& direntry->d_type != DT_UNKNOWN
&& __builtin_expect (lstat64 (real_file_name, &lstat_buf), 0))
@@ -836,7 +827,6 @@ search_dir (const struct dir_entry *entry)
free (new_entry);
continue;
}
-#endif
new_entry->ino = lstat_buf.st_ino;
new_entry->dev = lstat_buf.st_dev;
add_single_dir (new_entry, 0);
@@ -859,7 +849,6 @@ search_dir (const struct dir_entry *entry)
else
real_name = real_file_name;
-#ifdef _DIRENT_HAVE_D_TYPE
/* Call lstat64 if not done yet. */
if (!is_link
&& direntry->d_type != DT_UNKNOWN
@@ -868,7 +857,6 @@ search_dir (const struct dir_entry *entry)
error (0, errno, _("Cannot lstat %s"), file_name);
continue;
}
-#endif
/* First search whether the auxiliary cache contains this
library already and it's not changed. */
@@ -1271,6 +1259,10 @@ main (int argc, char **argv)
/* Set locale via LC_ALL. */
setlocale (LC_ALL, "");
+ /* But keep the C collation. That way `include' directives using
+ globbing patterns are processed in a locale-independent order. */
+ setlocale (LC_COLLATE, "C");
+
/* Set the text message domain. */
textdomain (_libc_intl_domainname);