OpenSDE Packages Database (without history before r20070)
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.

95 lines
2.7 KiB

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