summaryrefslogtreecommitdiffstats
path: root/sys-apps/kbd/files/kbd-1.12-find-map-fix.patch
blob: ca24703fcb5b72db465213f42350dd11577df599 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Oh, but I fixed it already. Patch below.

Andries

--- kbd-1.12.orig/src/findfile.c    Fri Jan 16 20:45:31 2004
+++ kbd-1.12/src/findfile.c        Wed Jan 28 23:29:35 2004
@@ -70,6 +70,7 @@
 	FILE *fp = NULL;
 	DIR *d;
 	struct dirent *de;
+	struct stat statbuf;
 	char *ff, *fdir, *p, *q, **sp;
 	struct decompressor *dc;
 	int secondpass = 0;
@@ -104,7 +105,6 @@
 	    okdir = (ff && strcmp(de->d_name, fdir) == 0);
 
 	    if ((secondpass && recdepth) || okdir) {
-       		struct stat statbuf;
 		char *a;
 
 		a = xmalloc(strlen(dir) + strlen(de->d_name) + 2);
@@ -137,6 +137,11 @@
 
 	    sprintf(pathname, "%s/%s", dir, de->d_name);
 
+	    /* Is this a regular file? */
+	    if (stat(pathname, &statbuf) != 0 ||
+		!S_ISREG(statbuf.st_mode))
+		continue;
+
 	    /* Does tail consist of a known suffix and possibly
 	       a compression suffix? */
 	    for(sp = suf; *sp; sp++) {


[pasted and cut from another window, so with whitespace damage]