Blame SOURCES/pinfo-0.6.9-infosuff.patch

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