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