aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-03-17 15:42:19 -0700
committerUlrich Sibiller <uli42@gmx.de>2016-10-10 22:52:31 +0200
commit70327993a44f2cfbe8ba46d42bdda7fea2327e1e (patch)
tree1c15ae29ba131dac1b8cdd19c182a21a3ac11a92
parentf573654008c47d8a9e8ea8bbb6d91edffa08ced2 (diff)
downloadnx-libs-70327993a44f2cfbe8ba46d42bdda7fea2327e1e.tar.gz
nx-libs-70327993a44f2cfbe8ba46d42bdda7fea2327e1e.tar.bz2
nx-libs-70327993a44f2cfbe8ba46d42bdda7fea2327e1e.zip
When makekeys fails to find a good hash, print error instead of divide-by-zero
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
-rw-r--r--nx-X11/lib/X11/util/makekeys.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/nx-X11/lib/X11/util/makekeys.c b/nx-X11/lib/X11/util/makekeys.c
index 0b515d758..626abba6d 100644
--- a/nx-X11/lib/X11/util/makekeys.c
+++ b/nx-X11/lib/X11/util/makekeys.c
@@ -150,6 +150,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");
@@ -230,6 +235,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++) {