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.

80 lines
2.0 KiB

  1. This is an alternative ldconfig wildcard expansion (glob) patch for
  2. recent glibc's.
  3. - Valentin Ziegler <valentin@rocklinux-consulting.de>
  4. --- ./elf/ldconfig.c.orig 2004-09-14 13:28:34.000000000 +0200
  5. +++ ./elf/ldconfig.c 2004-09-14 14:19:07.000000000 +0200
  6. @@ -359,21 +359,57 @@
  7. if (opt_chroot)
  8. path = chroot_canon (opt_chroot, path);
  9. - struct stat64 stat_buf;
  10. - if (path == NULL || stat64 (path, &stat_buf))
  11. - {
  12. - if (opt_verbose)
  13. - error (0, errno, _("Can't stat %s"), entry->path);
  14. - free (entry->path);
  15. - free (entry);
  16. - }
  17. - else
  18. - {
  19. - entry->ino = stat_buf.st_ino;
  20. - entry->dev = stat_buf.st_dev;
  21. + /* assume path is a pattern. - Valentin */
  22. - add_single_dir (entry, 1);
  23. - }
  24. + glob_t result;
  25. + if (glob(path, GLOB_ONLYDIR, NULL, &result) == 0) {
  26. +
  27. + for (int j = 0; j < result.gl_pathc; j++)
  28. + {
  29. + /* create a copy entry with expanded path */
  30. + struct dir_entry *real_entry = xmalloc (sizeof (struct dir_entry));
  31. + memcpy (real_entry, entry, sizeof (struct dir_entry));
  32. + real_entry->path = xstrdup (result.gl_pathv[j]);
  33. +
  34. + struct stat64 stat_buf;
  35. + if (real_entry -> path == NULL || stat64 (real_entry -> path, &stat_buf))
  36. + {
  37. + if (opt_verbose)
  38. + error (0, errno, _("Can't stat %s"), real_entry->path);
  39. + free (real_entry->path);
  40. + free (real_entry);
  41. + }
  42. + else
  43. + {
  44. + real_entry->ino = stat_buf.st_ino;
  45. + real_entry->dev = stat_buf.st_dev;
  46. +
  47. + add_single_dir (real_entry, 1);
  48. + }
  49. + }
  50. +
  51. + } else {
  52. + /* fallback to code from glibc with orig. error handling */
  53. + struct stat64 stat_buf;
  54. + if (path == NULL || stat64 (path, &stat_buf))
  55. + {
  56. + if (opt_verbose)
  57. + error (0, errno, _("Can't stat %s"), entry->path);
  58. + free (entry->path);
  59. + free (entry);
  60. + }
  61. + else
  62. + {
  63. + entry->ino = stat_buf.st_ino;
  64. + entry->dev = stat_buf.st_dev;
  65. +
  66. + add_single_dir (entry, 1);
  67. + }
  68. + }
  69. +
  70. + globfree (&result);
  71. +
  72. + /* ******************************* */
  73. if (opt_chroot)
  74. free (path);