* updated kmines (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / architecture / sparc / package / glibc / ldconfig-glob.patch
blobe9ed6d7b479959c705902e6b4438759e2c1520a0
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../glibc/ldconfig-glob.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
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
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 This is an alternative ldconfig wildcard expansion (glob) patch for
18 recent glibc's.
20 - Valentin Ziegler <valentin@exactcode.de>
22 --- ./elf/ldconfig.c.orig 2004-09-14 13:28:34.000000000 +0200
23 +++ ./elf/ldconfig.c 2004-09-14 14:19:07.000000000 +0200
24 @@ -359,21 +359,57 @@
25 if (opt_chroot)
26 path = chroot_canon (opt_chroot, path);
28 - struct stat64 stat_buf;
29 - if (path == NULL || stat64 (path, &stat_buf))
30 - {
31 - if (opt_verbose)
32 - error (0, errno, _("Can't stat %s"), entry->path);
33 - free (entry->path);
34 - free (entry);
35 - }
36 - else
37 - {
38 - entry->ino = stat_buf.st_ino;
39 - entry->dev = stat_buf.st_dev;
40 + /* assume path is a pattern. - Valentin */
42 - add_single_dir (entry, 1);
43 - }
44 + glob_t result;
45 + if (glob(path, GLOB_ONLYDIR, NULL, &result) == 0) {
47 + for (int j = 0; j < result.gl_pathc; j++)
48 + {
49 + /* create a copy entry with expanded path */
50 + struct dir_entry *real_entry = xmalloc (sizeof (struct dir_entry));
51 + memcpy (real_entry, entry, sizeof (struct dir_entry));
52 + real_entry->path = xstrdup (result.gl_pathv[j]);
54 + struct stat64 stat_buf;
55 + if (real_entry -> path == NULL || stat64 (real_entry -> path, &stat_buf))
56 + {
57 + if (opt_verbose)
58 + error (0, errno, _("Can't stat %s"), real_entry->path);
59 + free (real_entry->path);
60 + free (real_entry);
61 + }
62 + else
63 + {
64 + real_entry->ino = stat_buf.st_ino;
65 + real_entry->dev = stat_buf.st_dev;
67 + add_single_dir (real_entry, 1);
68 + }
69 + }
71 + } else {
72 + /* fallback to code from glibc with orig. error handling */
73 + struct stat64 stat_buf;
74 + if (path == NULL || stat64 (path, &stat_buf))
75 + {
76 + if (opt_verbose)
77 + error (0, errno, _("Can't stat %s"), entry->path);
78 + free (entry->path);
79 + free (entry);
80 + }
81 + else
82 + {
83 + entry->ino = stat_buf.st_ino;
84 + entry->dev = stat_buf.st_dev;
86 + add_single_dir (entry, 1);
87 + }
88 + }
90 + globfree (&result);
92 + /* ******************************* */
94 if (opt_chroot)
95 free (path);