man-db-2.6.2-invalid-cache.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. diff -upr man-db-2.6.2.orig/src/check_mandirs.c man-db-2.6.2/src/check_mandirs.c
  2. --- man-db-2.6.2.orig/src/check_mandirs.c 2011-07-09 20:53:38.000000000 +0200
  3. +++ man-db-2.6.2/src/check_mandirs.c 2012-07-31 13:05:45.967640117 +0200
  4. @@ -190,8 +190,7 @@ void test_manfile (const char *file, con
  5. comp extensions */
  6. abs_filename = make_filename (path, NULL,
  7. exists, "man");
  8. - debug ("test_manfile(): stat %s\n", abs_filename);
  9. - if (stat (abs_filename, &physical) == -1) {
  10. + if (abs_filename == NULL || stat (abs_filename, &physical) == -1) {
  11. if (!opt_test)
  12. dbdelete (manpage_base, exists);
  13. } else {
  14. diff -upr man-db-2.6.2.orig/src/filenames.c man-db-2.6.2/src/filenames.c
  15. --- man-db-2.6.2.orig/src/filenames.c 2011-10-09 01:19:00.000000000 +0200
  16. +++ man-db-2.6.2/src/filenames.c 2012-07-31 12:31:10.436885216 +0200
  17. @@ -27,6 +27,7 @@
  18. #include <string.h>
  19. #include <stdlib.h>
  20. +#include <unistd.h>
  21. #include "xvasprintf.h"
  22. @@ -61,6 +62,11 @@ char *make_filename (const char *path, c
  23. if (in->comp && *in->comp != '-') /* Is there an extension? */
  24. file = appendstr (file, ".", in->comp, NULL);
  25. + if (access (file, R_OK) != 0) {
  26. + free (file);
  27. + return NULL;
  28. + }
  29. +
  30. return file;
  31. }
  32. diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c
  33. --- man-db-2.6.2.orig/src/man.c 2012-05-15 01:24:17.000000000 +0200
  34. +++ man-db-2.6.2/src/man.c 2012-07-31 13:04:48.629069419 +0200
  35. @@ -3103,6 +3103,9 @@ static int add_candidate (struct candida
  36. name = req_name;
  37. filename = make_filename (path, name, source, cat ? "cat" : "man");
  38. + if (filename == NULL) {
  39. + return 0;
  40. + }
  41. ult = ult_src (filename, path, NULL,
  42. get_ult_flags (from_db, source->id), NULL);
  43. free (filename);
  44. @@ -3309,6 +3312,9 @@ static int display_filesystem (struct ca
  45. {
  46. char *filename = make_filename (candp->path, NULL, candp->source,
  47. candp->cat ? "cat" : "man");
  48. + if (filename == NULL) {
  49. + return 0;
  50. + }
  51. /* source->name is never NULL thanks to add_candidate() */
  52. char *title = appendstr (NULL, candp->source->name,
  53. "(", candp->source->ext, ")", NULL);
  54. @@ -3392,14 +3398,14 @@ static int display_database (struct cand
  55. if (in->id < STRAY_CAT) { /* There should be a src page */
  56. file = make_filename (candp->path, name, in, "man");
  57. - debug ("Checking physical location: %s\n", file);
  58. + if (file != NULL) {
  59. + debug ("Checking physical location: %s\n", file);
  60. - if (access (file, R_OK) == 0) {
  61. const char *man_file;
  62. char *cat_file;
  63. man_file = ult_src (file, candp->path, NULL,
  64. - get_ult_flags (1, in->id), NULL);
  65. + get_ult_flags (1, in->id), NULL);
  66. if (man_file == NULL) {
  67. free (title);
  68. return found; /* zero */
  69. @@ -3416,7 +3422,7 @@ static int display_database (struct cand
  70. free (lang);
  71. lang = NULL;
  72. } /* else {drop through to the bottom and return 0 anyway} */
  73. - } else
  74. + } else
  75. #endif /* NROFF_MISSING */
  76. @@ -3441,9 +3447,9 @@ static int display_database (struct cand
  77. }
  78. file = make_filename (candp->path, name, in, "cat");
  79. - debug ("Checking physical location: %s\n", file);
  80. -
  81. - if (access (file, R_OK) != 0) {
  82. + if (file != NULL) {
  83. + debug ("Checking physical location: %s\n", file);
  84. + } else {
  85. char *catpath;
  86. catpath = get_catpath (candp->path,
  87. global_manpath ? SYSTEM_CAT
  88. @@ -3453,10 +3459,10 @@ static int display_database (struct cand
  89. file = make_filename (catpath, name,
  90. in, "cat");
  91. free (catpath);
  92. - debug ("Checking physical location: %s\n",
  93. - file);
  94. -
  95. - if (access (file, R_OK) != 0) {
  96. + if (file != NULL) {
  97. + debug ("Checking physical location: %s\n",
  98. + file);
  99. + } else {
  100. /* don't delete here,
  101. return==0 will do that */
  102. free (title);
  103. @@ -3520,6 +3526,8 @@ static int maybe_update_file (const char
  104. real_name = name;
  105. file = make_filename (manpath, real_name, info, "man");
  106. + if (file == NULL)
  107. + return 0;
  108. if (lstat (file, &buf) != 0)
  109. return 0;
  110. if (buf.st_mtime == info->_st_mtime)