Blame SOURCES/man-db-2.6.2-invalid-cache.patch

e36484
diff -upr man-db-2.6.2.orig/src/check_mandirs.c man-db-2.6.2/src/check_mandirs.c
e36484
--- man-db-2.6.2.orig/src/check_mandirs.c	2011-07-09 20:53:38.000000000 +0200
e36484
+++ man-db-2.6.2/src/check_mandirs.c	2012-07-31 13:05:45.967640117 +0200
e36484
@@ -190,8 +190,7 @@ void test_manfile (const char *file, con
e36484
 			   comp extensions */
e36484
 			abs_filename = make_filename (path, NULL,
e36484
 						      exists, "man");
e36484
-			debug ("test_manfile(): stat %s\n", abs_filename);
e36484
-			if (stat (abs_filename, &physical) == -1) {
e36484
+			if (abs_filename == NULL || stat (abs_filename, &physical) == -1) {
e36484
 				if (!opt_test)
e36484
 					dbdelete (manpage_base, exists);
e36484
 			} else {
e36484
diff -upr man-db-2.6.2.orig/src/filenames.c man-db-2.6.2/src/filenames.c
e36484
--- man-db-2.6.2.orig/src/filenames.c	2011-10-09 01:19:00.000000000 +0200
e36484
+++ man-db-2.6.2/src/filenames.c	2012-07-31 12:31:10.436885216 +0200
e36484
@@ -27,6 +27,7 @@
e36484
 
e36484
 #include <string.h>
e36484
 #include <stdlib.h>
e36484
+#include <unistd.h>
e36484
 
e36484
 #include "xvasprintf.h"
e36484
 
e36484
@@ -61,6 +62,11 @@ char *make_filename (const char *path, c
e36484
 	if (in->comp && *in->comp != '-')	/* Is there an extension? */
e36484
 		file = appendstr (file, ".", in->comp, NULL);
e36484
 
e36484
+	if (access (file, R_OK) != 0) {
e36484
+		free (file);
e36484
+		return NULL;
e36484
+	}
e36484
+
e36484
 	return file;
e36484
 }
e36484
 
e36484
diff -upr man-db-2.6.2.orig/src/man.c man-db-2.6.2/src/man.c
e36484
--- man-db-2.6.2.orig/src/man.c	2012-05-15 01:24:17.000000000 +0200
e36484
+++ man-db-2.6.2/src/man.c	2012-07-31 13:04:48.629069419 +0200
e36484
@@ -3103,6 +3103,9 @@ static int add_candidate (struct candida
e36484
 			name = req_name;
e36484
 
e36484
 		filename = make_filename (path, name, source, cat ? "cat" : "man");
e36484
+		if (filename == NULL) {
e36484
+			return 0;
e36484
+		}
e36484
 		ult = ult_src (filename, path, NULL,
e36484
 			       get_ult_flags (from_db, source->id), NULL);
e36484
 		free (filename);
e36484
@@ -3309,6 +3312,9 @@ static int display_filesystem (struct ca
e36484
 {
e36484
 	char *filename = make_filename (candp->path, NULL, candp->source,
e36484
 					candp->cat ? "cat" : "man");
e36484
+	if (filename == NULL) {
e36484
+		return 0;
e36484
+	}
e36484
 	/* source->name is never NULL thanks to add_candidate() */
e36484
 	char *title = appendstr (NULL, candp->source->name,
e36484
 				 "(", candp->source->ext, ")", NULL);
e36484
@@ -3392,14 +3398,14 @@ static int display_database (struct cand
e36484
 
e36484
 	if (in->id < STRAY_CAT) {	/* There should be a src page */
e36484
 		file = make_filename (candp->path, name, in, "man");
e36484
-		debug ("Checking physical location: %s\n", file);
e36484
+		if (file != NULL) {
e36484
+			debug ("Checking physical location: %s\n", file);
e36484
 
e36484
-		if (access (file, R_OK) == 0) {
e36484
 			const char *man_file;
e36484
 			char *cat_file;
e36484
 
e36484
 			man_file = ult_src (file, candp->path, NULL,
e36484
-					    get_ult_flags (1, in->id), NULL);
e36484
+						get_ult_flags (1, in->id), NULL);
e36484
 			if (man_file == NULL) {
e36484
 				free (title);
e36484
 				return found; /* zero */
e36484
@@ -3416,7 +3422,7 @@ static int display_database (struct cand
e36484
 			free (lang);
e36484
 			lang = NULL;
e36484
 		} /* else {drop through to the bottom and return 0 anyway} */
e36484
-	} else 
e36484
+	} else
e36484
 
e36484
 #endif /* NROFF_MISSING */
e36484
 
e36484
@@ -3441,9 +3447,9 @@ static int display_database (struct cand
e36484
 		}
e36484
 
e36484
 		file = make_filename (candp->path, name, in, "cat");
e36484
-		debug ("Checking physical location: %s\n", file);
e36484
-
e36484
-		if (access (file, R_OK) != 0) {
e36484
+		if (file != NULL) {
e36484
+			debug ("Checking physical location: %s\n", file);
e36484
+		} else {
e36484
 			char *catpath;
e36484
 			catpath = get_catpath (candp->path,
e36484
 					       global_manpath ? SYSTEM_CAT
e36484
@@ -3453,10 +3459,10 @@ static int display_database (struct cand
e36484
 				file = make_filename (catpath, name,
e36484
 						      in, "cat");
e36484
 				free (catpath);
e36484
-				debug ("Checking physical location: %s\n",
e36484
-				       file);
e36484
-
e36484
-				if (access (file, R_OK) != 0) {
e36484
+				if (file != NULL) {
e36484
+					debug ("Checking physical location: %s\n",
e36484
+						   file);
e36484
+				} else {
e36484
 					/* don't delete here, 
e36484
 					   return==0 will do that */
e36484
 					free (title);
e36484
@@ -3520,6 +3526,8 @@ static int maybe_update_file (const char
e36484
 		real_name = name;
e36484
 
e36484
 	file = make_filename (manpath, real_name, info, "man");
e36484
+	if (file == NULL)
e36484
+		return 0;
e36484
 	if (lstat (file, &buf) != 0)
e36484
 		return 0;
e36484
 	if (buf.st_mtime == info->_st_mtime)