From 12452d919898af64a3f6aa3403aa56c2cceb5ed3 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Tue, 21 Jun 2011 13:13:15 +0000 Subject: Don't let empty strings into the makewhatis keyword database. --- Makefile | 2 +- makewhatis.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c535f105..86399a57 100644 --- a/Makefile +++ b/Makefile @@ -353,7 +353,7 @@ llib-lmandoc.ln: $(MANDOC_LNS) # You'll need -ldb for Linux. makewhatis: $(MAKEWHATIS_OBJS) libmandoc.a - $(CC) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a + $(CC) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a -ldb llib-lmakewhatis.ln: $(MAKEWHATIS_LNS) $(LINT) $(LINTFLAGS) -Cmakewhatis $(MAKEWHATIS_LNS) diff --git a/makewhatis.c b/makewhatis.c index ec7f6676..94202dd5 100644 --- a/makewhatis.c +++ b/makewhatis.c @@ -1,4 +1,4 @@ -/* $Id: makewhatis.c,v 1.3 2011/06/21 13:05:14 kristaps Exp $ */ +/* $Id: makewhatis.c,v 1.4 2011/06/21 13:13:15 kristaps Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * @@ -792,7 +792,8 @@ hash_put(DB *db, const struct buf *buf, int mask) int rc; key.data = buf->cp; - if (0 == (key.size = buf->len)) + + if ((key.size = buf->len) < 2) return; if ((rc = (*db->get)(db, &key, &val, 0)) < 0) { -- cgit v1.2.3