mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.9 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/glibc/glibc23/ldconfig-glob.patch
  9. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  10. #
  11. # This patch file is dual-licensed. It is available under the license the
  12. # patched project is licensed under, as long as it is an OpenSource license
  13. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  14. # of the GNU General Public License as published by the Free Software
  15. # Foundation; either version 2 of the License, or (at your option) any later
  16. # version.
  17. #
  18. # --- ROCK-COPYRIGHT-NOTE-END ---
  19. This is an alternative ldconfig wildcard expansion (glob) patch for
  20. recent glibc's.
  21. - Valentin Ziegler <valentin@rocklinux-consulting.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);
  27. - struct stat64 stat_buf;
  28. - if (path == NULL || stat64 (path, &stat_buf))
  29. - {
  30. - if (opt_verbose)
  31. - error (0, errno, _("Can't stat %s"), entry->path);
  32. - free (entry->path);
  33. - free (entry);
  34. - }
  35. - else
  36. - {
  37. - entry->ino = stat_buf.st_ino;
  38. - entry->dev = stat_buf.st_dev;
  39. + /* assume path is a pattern. - Valentin */
  40. - add_single_dir (entry, 1);
  41. - }
  42. + glob_t result;
  43. + if (glob(path, GLOB_ONLYDIR, NULL, &result) == 0) {
  44. +
  45. + for (int j = 0; j < result.gl_pathc; j++)
  46. + {
  47. + /* create a copy entry with expanded path */
  48. + struct dir_entry *real_entry = xmalloc (sizeof (struct dir_entry));
  49. + memcpy (real_entry, entry, sizeof (struct dir_entry));
  50. + real_entry->path = xstrdup (result.gl_pathv[j]);
  51. +
  52. + struct stat64 stat_buf;
  53. + if (real_entry -> path == NULL || stat64 (real_entry -> path, &stat_buf))
  54. + {
  55. + if (opt_verbose)
  56. + error (0, errno, _("Can't stat %s"), real_entry->path);
  57. + free (real_entry->path);
  58. + free (real_entry);
  59. + }
  60. + else
  61. + {
  62. + real_entry->ino = stat_buf.st_ino;
  63. + real_entry->dev = stat_buf.st_dev;
  64. +
  65. + add_single_dir (real_entry, 1);
  66. + }
  67. + }
  68. +
  69. + } else {
  70. + /* fallback to code from glibc with orig. error handling */
  71. + struct stat64 stat_buf;
  72. + if (path == NULL || stat64 (path, &stat_buf))
  73. + {
  74. + if (opt_verbose)
  75. + error (0, errno, _("Can't stat %s"), entry->path);
  76. + free (entry->path);
  77. + free (entry);
  78. + }
  79. + else
  80. + {
  81. + entry->ino = stat_buf.st_ino;
  82. + entry->dev = stat_buf.st_dev;
  83. +
  84. + add_single_dir (entry, 1);
  85. + }
  86. + }
  87. +
  88. + globfree (&result);
  89. +
  90. + /* ******************************* */
  91. if (opt_chroot)
  92. free (path);