libx11-trim: Update makekeys.c to fix the compile
authorHolger Hans Peter Freyther <zecke@selfish.org>
Tue, 28 Jul 2009 01:53:56 +0000 (03:53 +0200)
committerHolger Hans Peter Freyther <zecke@selfish.org>
Tue, 28 Jul 2009 07:22:40 +0000 (09:22 +0200)
Without the updated makekeys-update.patch the makekeys.c
will not work and the build will be broken.

recipes/xorg-lib/libx11-trim/makekeys-update.patch [new file with mode: 0644]
recipes/xorg-lib/libx11-trim_1.1.5.bb

diff --git a/recipes/xorg-lib/libx11-trim/makekeys-update.patch b/recipes/xorg-lib/libx11-trim/makekeys-update.patch
new file mode 100644 (file)
index 0000000..323dbbb
--- /dev/null
@@ -0,0 +1,87 @@
+From f8613deafdc7c6f3be49c3448e011426bcfdf78e Mon Sep 17 00:00:00 2001
+From: Holger Hans Peter Freyther <zecke@selfish.org>
+Date: Tue, 28 Jul 2009 03:20:20 +0200
+Subject: [PATCH] makekeys.c: Replace with the latest version to fix a segfault
+
+Fix a crash..
+---
+ src/util/makekeys.c |   28 +++++++++++++++++-----------
+ 1 files changed, 17 insertions(+), 11 deletions(-)
+
+diff --git a/src/util/makekeys.c b/src/util/makekeys.c
+index 214ea5c..3fe8a96 100644
+--- a/src/util/makekeys.c
++++ b/src/util/makekeys.c
+@@ -36,13 +36,10 @@ from The Open Group.
+ #include <X11/keysymdef.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+-#if defined(macII) && !defined(__STDC__)  /* stdlib.h fails to define these */
+-char *malloc();
+-#endif /* macII */
+ typedef unsigned long Signature;
+-#define KTNUM 3000
++#define KTNUM 4000
+ static struct info {
+     char      *name;
+@@ -52,11 +49,11 @@ static struct info {
+ #define MIN_REHASH 15
+ #define MATCHES 10
+-char tab[KTNUM];
+-unsigned short offsets[KTNUM];
+-unsigned short indexes[KTNUM];
+-KeySym values[KTNUM];
+-char buf[1024];
++static char tab[KTNUM];
++static unsigned short offsets[KTNUM];
++static unsigned short indexes[KTNUM];
++static KeySym values[KTNUM];
++static char buf[1024];
+ int
+ main(int argc, char *argv[])
+@@ -103,12 +100,11 @@ main(int argc, char *argv[])
+                   key);
+           continue;
+       }
+-      name = malloc((unsigned)strlen(key)+1);
++      name = strdup(key);
+       if (!name) {
+           fprintf(stderr, "makekeys: out of memory!\n");
+           exit(1);
+       }
+-      (void)strcpy(name, key);
+       info[ksnum].name = name;
+       ksnum++;
+       if (ksnum == KTNUM) {
+@@ -157,6 +153,11 @@ next1:    ;
+     }
+     z = best_z;
++    if (z == 0) {
++      fprintf(stderr, "makekeys: failed to find small enough hash!\n"
++              "Try increasing KTNUM in makekeys.c\n");
++      exit(1);
++    }
+     printf("#ifdef NEEDKTABLE\n");
+     printf("const unsigned char _XkeyTable[] = {\n");
+     printf("0,\n");
+@@ -237,6 +238,11 @@ next2:    ;
+     }
+     z = best_z;
++    if (z == 0) {
++      fprintf(stderr, "makekeys: failed to find small enough hash!\n"
++              "Try increasing KTNUM in makekeys.c\n");
++      exit(1);
++    }
+     for (i = z; --i >= 0;)
+       offsets[i] = 0;
+     for (i = 0; i < ksnum; i++) {
+-- 
+1.6.3.3
+
index e99b2a0..9d08d25 100644 (file)
@@ -14,7 +14,8 @@ PR = "r1"
 XORG_PN = "libX11"
 LEAD_SONAME = "libX11.so"
 
-SRC_URI += "file://include_fix.patch;patch=1"
+SRC_URI += "file://include_fix.patch;patch=1 \
+            file://makekeys-update.patch;patch=1"
 
 EXTRA_OECONF += "--with-keysymdef=${STAGING_INCDIR}/X11/keysymdef.h"
 #EXTRA_OECONF += "--disable-xlocale --disable-xcms --with-xcb"