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