Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit history_def_enter: fix off-by-one mistake in del...



details:   https://anonhg.NetBSD.org/src/rev/d4a1cfdef34a
branches:  trunk
changeset: 515606:d4a1cfdef34a
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Sep 29 17:52:10 2001 +0000

description:
history_def_enter: fix off-by-one mistake in delete condition (the behaviour
to keep at least one entry on the history list is retained)
This fixes lib/9704 by Phil Nelson.

diffstat:

 lib/libedit/history.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 65b6e8c93be5 -r d4a1cfdef34a lib/libedit/history.c
--- a/lib/libedit/history.c     Sat Sep 29 17:04:10 2001 +0000
+++ b/lib/libedit/history.c     Sat Sep 29 17:52:10 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: history.c,v 1.17 2001/03/20 00:08:31 christos Exp $    */
+/*     $NetBSD: history.c,v 1.18 2001/09/29 17:52:10 jdolecek Exp $    */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.17 2001/03/20 00:08:31 christos Exp $");
+__RCSID("$NetBSD: history.c,v 1.18 2001/09/29 17:52:10 jdolecek Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -410,7 +410,7 @@
          * Always keep at least one entry.
          * This way we don't have to check for the empty list.
          */
-       while (h->cur - 1 > h->max)
+       while (h->cur > h->max && h->cur > 0)
                history_def_delete(h, ev, h->list.prev);
 
        return (0);



Home | Main Index | Thread Index | Old Index