Blame SOURCES/pinfo-0.6.9-infosuff.patch

096b71
--- pinfo-0.6.9/src/filehandling_functions.c.infosuff	2006-03-16 16:15:02.000000000 +0100
096b71
+++ pinfo-0.6.9/src/filehandling_functions.c	2006-09-18 14:32:32.000000000 +0200
096b71
@@ -94,6 +94,7 @@
096b71
 	/* iterate over all files in the directory */
096b71
 	while ((dp = readdir(dir)) != NULL)
096b71
 	{
096b71
+		int info_suffix;
096b71
 		/* use strcat rather than strdup, because xmalloc handles all 
096b71
 		 * malloc errors */
096b71
 		char *thisfile = xmalloc(strlen(dp->d_name)+1);
096b71
@@ -101,7 +102,9 @@
096b71
 
096b71
 		/* strip suffixes (so "gcc.info.gz" -> "gcc") */
096b71
 		strip_compression_suffix(thisfile);
096b71
+		info_suffix = strlen(thisfile);
096b71
 		strip_info_suffix(thisfile);
096b71
+		info_suffix -= strlen(thisfile);
096b71
 
096b71
 		/* compare this file with the file we're looking for */
096b71
 		if (strcmp(thisfile,bname) == 0)
096b71
@@ -110,7 +113,8 @@
096b71
 			matched++;
096b71
 			/* put it in the buffer */
096b71
 			strncat(Buf, thisfile, 1023-strlen(Buf));
096b71
-			strncat(Buf, ".info", 1023-strlen(Buf));
096b71
+			if (info_suffix)
096b71
+				strncat(Buf, ".info", 1023-strlen(Buf));
096b71
 
096b71
 			/* clean up, and exit the loop */
096b71
 			xfree(thisfile);