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