Blame SOURCES/pinfo-0.6.9-infosuff.patch

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