1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
4 # T2 SDE: package/*/glibc/ldconfig-glob.patch
5 # Copyright (C) 2004 - 2021 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 This is an alternative ldconfig wildcard expansion (glob) patch for
20 - Valentin Ziegler <valentin@exactcode.de>
22 --- glibc-2.33/elf/ldconfig.c.vanilla 2021-02-02 13:02:34.684800081 +0100
23 +++ glibc-2.33/elf/ldconfig.c 2021-02-02 13:25:04.253869704 +0100
26 path = chroot_canon (opt_chroot, path);
28 - struct stat64 stat_buf;
29 - if (path == NULL || stat64 (path, &stat_buf))
32 - error (0, errno, _("Can't stat %s"), entry->path);
38 - entry->ino = stat_buf.st_ino;
39 - entry->dev = stat_buf.st_dev;
40 + /* assume path is a pattern */
42 + if (glob(path, GLOB_ONLYDIR, NULL, &result) == 0) {
43 + for (int j = 0; j < result.gl_pathc; j++)
45 + /* create a copy entry with expanded path */
46 + struct dir_entry *real_entry = xmalloc (sizeof (struct dir_entry));
47 + memcpy (real_entry, entry, sizeof (struct dir_entry));
48 + real_entry->path = xstrdup (result.gl_pathv[j]);
50 - if (add_single_dir (entry, 1))
51 - /* Add glibc-hwcaps subdirectories if present. */
52 - add_glibc_hwcaps_subdirectories (entry, path);
54 + struct stat64 stat_buf;
55 + if (real_entry->path == NULL || stat64 (real_entry->path, &stat_buf))
58 + error (0, errno, _("Can't stat %s"), real_entry->path);
59 + free (real_entry->path);
64 + real_entry->ino = stat_buf.st_ino;
65 + real_entry->dev = stat_buf.st_dev;
67 + if (add_single_dir (real_entry, 1))
68 + /* Add glibc-hwcaps subdirectories if present. */
69 + add_glibc_hwcaps_subdirectories (real_entry, real_entry->path);
73 + /* fallback to code from glibc with orig. error handling */
74 + struct stat64 stat_buf;
75 + if (path == NULL || stat64 (path, &stat_buf))
78 + error (0, errno, _("Can't stat %s"), entry->path);
84 + entry->ino = stat_buf.st_ino;
85 + entry->dev = stat_buf.st_dev;
87 + if (add_single_dir (entry, 1))
88 + /* Add glibc-hwcaps subdirectories if present. */
89 + add_glibc_hwcaps_subdirectories (entry, path);