Module Name:    src
Committed By:   christos
Date:           Sun Jan 16 03:05:51 UTC 2011

Modified Files:
        src/lib/libedit: history.c

Log Message:
off by one in fetching history data. From: Gerry Swislow


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libedit/history.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libedit/history.c
diff -u src/lib/libedit/history.c:1.37 src/lib/libedit/history.c:1.38
--- src/lib/libedit/history.c:1.37	Sun Jan  3 13:27:10 2010
+++ src/lib/libedit/history.c	Sat Jan 15 22:05:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: history.c,v 1.37 2010/01/03 18:27:10 christos Exp $	*/
+/*	$NetBSD: history.c,v 1.38 2011/01/16 03:05:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.37 2010/01/03 18:27:10 christos Exp $");
+__RCSID("$NetBSD: history.c,v 1.38 2011/01/16 03:05:51 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -857,7 +857,7 @@
 	int retval;
 
 	for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev))
-		if (num-- <= 0) {
+		if (ev->num == num) {
 			if (d)
 				*d = ((history_t *)h->h_ref)->cursor->data;
 			return (0);

Reply via email to