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

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