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 - 2005 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 --- ./elf/ldconfig.c.orig 2004-09-14 13:28:34.000000000 +0200
23 +++ ./elf/ldconfig.c 2004-09-14 14:19:07.000000000 +0200
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. - Valentin */
42 - add_single_dir (entry, 1);
45 + if (glob(path, GLOB_ONLYDIR, NULL, &result) == 0) {
47 + for (int j = 0; j < result.gl_pathc; j++)
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))
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 + add_single_dir (real_entry, 1);
72 + /* fallback to code from glibc with orig. error handling */
73 + struct stat64 stat_buf;
74 + if (path == NULL || stat64 (path, &stat_buf))
77 + error (0, errno, _("Can't stat %s"), entry->path);
83 + entry->ino = stat_buf.st_ino;
84 + entry->dev = stat_buf.st_dev;
86 + add_single_dir (entry, 1);
92 + /* ******************************* */