From 70327993a44f2cfbe8ba46d42bdda7fea2327e1e Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Tue, 17 Mar 2009 15:42:19 -0700 Subject: When makekeys fails to find a good hash, print error instead of divide-by-zero Signed-off-by: Alan Coopersmith --- nx-X11/lib/X11/util/makekeys.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'nx-X11/lib/X11') 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++) { -- cgit v1.2.3