124 lines
3.9 KiB
Diff
124 lines
3.9 KiB
Diff
diff -upr man-db-2.6.5.orig/src/check_mandirs.c man-db-2.6.5/src/check_mandirs.c
|
|
--- man-db-2.6.5.orig/src/check_mandirs.c 2013-06-27 11:01:22.000000000 +0200
|
|
+++ man-db-2.6.5/src/check_mandirs.c 2013-06-27 13:42:36.410902580 +0200
|
|
@@ -190,8 +190,7 @@ void test_manfile (const char *file, con
|
|
comp extensions */
|
|
abs_filename = make_filename (path, NULL,
|
|
exists, "man");
|
|
- debug ("test_manfile(): stat %s\n", abs_filename);
|
|
- if (stat (abs_filename, &physical) == -1) {
|
|
+ if (abs_filename == NULL || stat (abs_filename, &physical) == -1) {
|
|
if (!opt_test)
|
|
dbdelete (manpage_base, exists);
|
|
} else {
|
|
diff -upr man-db-2.6.5.orig/src/filenames.c man-db-2.6.5/src/filenames.c
|
|
--- man-db-2.6.5.orig/src/filenames.c 2011-10-09 01:19:00.000000000 +0200
|
|
+++ man-db-2.6.5/src/filenames.c 2013-06-27 13:42:36.411902591 +0200
|
|
@@ -27,6 +27,7 @@
|
|
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
+#include <unistd.h>
|
|
|
|
#include "xvasprintf.h"
|
|
|
|
@@ -61,6 +62,11 @@ char *make_filename (const char *path, c
|
|
if (in->comp && *in->comp != '-') /* Is there an extension? */
|
|
file = appendstr (file, ".", in->comp, NULL);
|
|
|
|
+ if (access (file, R_OK) != 0) {
|
|
+ free (file);
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
return file;
|
|
}
|
|
|
|
diff -upr man-db-2.6.5.orig/src/man.c man-db-2.6.5/src/man.c
|
|
--- man-db-2.6.5.orig/src/man.c 2013-06-27 11:09:56.000000000 +0200
|
|
+++ man-db-2.6.5/src/man.c 2013-06-27 13:42:36.413902605 +0200
|
|
@@ -3114,6 +3114,9 @@ static int add_candidate (struct candida
|
|
name = req_name;
|
|
|
|
filename = make_filename (path, name, source, cat ? "cat" : "man");
|
|
+ if (filename == NULL) {
|
|
+ return 0;
|
|
+ }
|
|
ult = ult_src (filename, path, NULL,
|
|
get_ult_flags (from_db, source->id), NULL);
|
|
free (filename);
|
|
@@ -3331,6 +3334,9 @@ static int display_filesystem (struct ca
|
|
{
|
|
char *filename = make_filename (candp->path, NULL, candp->source,
|
|
candp->cat ? "cat" : "man");
|
|
+ if (filename == NULL) {
|
|
+ return 0;
|
|
+ }
|
|
/* source->name is never NULL thanks to add_candidate() */
|
|
char *title = xasprintf ("%s(%s)", candp->source->name,
|
|
candp->source->ext);
|
|
@@ -3421,14 +3427,14 @@ static int display_database (struct cand
|
|
|
|
if (in->id < STRAY_CAT) { /* There should be a src page */
|
|
file = make_filename (candp->path, name, in, "man");
|
|
- debug ("Checking physical location: %s\n", file);
|
|
+ if (file != NULL) {
|
|
+ debug ("Checking physical location: %s\n", file);
|
|
|
|
- if (access (file, R_OK) == 0) {
|
|
const char *man_file;
|
|
char *cat_file;
|
|
|
|
man_file = ult_src (file, candp->path, NULL,
|
|
- get_ult_flags (1, in->id), NULL);
|
|
+ get_ult_flags (1, in->id), NULL);
|
|
if (man_file == NULL) {
|
|
free (title);
|
|
return found; /* zero */
|
|
@@ -3445,7 +3451,7 @@ static int display_database (struct cand
|
|
free (lang);
|
|
lang = NULL;
|
|
} /* else {drop through to the bottom and return 0 anyway} */
|
|
- } else
|
|
+ } else
|
|
|
|
#endif /* NROFF_MISSING */
|
|
|
|
@@ -3470,9 +3476,9 @@ static int display_database (struct cand
|
|
}
|
|
|
|
file = make_filename (candp->path, name, in, "cat");
|
|
- debug ("Checking physical location: %s\n", file);
|
|
-
|
|
- if (access (file, R_OK) != 0) {
|
|
+ if (file != NULL) {
|
|
+ debug ("Checking physical location: %s\n", file);
|
|
+ } else {
|
|
char *catpath;
|
|
catpath = get_catpath (candp->path,
|
|
global_manpath ? SYSTEM_CAT
|
|
@@ -3482,10 +3488,10 @@ static int display_database (struct cand
|
|
file = make_filename (catpath, name,
|
|
in, "cat");
|
|
free (catpath);
|
|
- debug ("Checking physical location: %s\n",
|
|
- file);
|
|
-
|
|
- if (access (file, R_OK) != 0) {
|
|
+ if (file != NULL) {
|
|
+ debug ("Checking physical location: %s\n",
|
|
+ file);
|
|
+ } else {
|
|
/* don't delete here,
|
|
return==0 will do that */
|
|
free (title);
|
|
@@ -3549,6 +3555,8 @@ static int maybe_update_file (const char
|
|
real_name = name;
|
|
|
|
file = make_filename (manpath, real_name, info, "man");
|
|
+ if (file == NULL)
|
|
+ return 0;
|
|
if (lstat (file, &buf) != 0)
|
|
return 0;
|
|
if (buf.st_mtime == info->_st_mtime)
|