diff options
author | 2016-05-08 13:34:35 +0000 | |
---|---|---|
committer | 2016-05-08 13:34:35 +0000 | |
commit | 07f7d775ab33a2f2c794af7626fe7d914fe03d5e (patch) | |
tree | 3d0e1475c67d6f996f395b500db3578575f2eb28 | |
parent | Wait for RAM in uvm_fault when allocating uvm structures fails (diff) | |
download | wireguard-openbsd-07f7d775ab33a2f2c794af7626fe7d914fe03d5e.tar.xz wireguard-openbsd-07f7d775ab33a2f2c794af7626fe7d914fe03d5e.zip |
Make the history_set_pos() return values agree with the GNU implementation.
Patch from Bastian Maerkisch <bmaerkisch at web dot de>
with a minor tweak from Christos Zoulas.
Fixes the test_set_pos_return_values() regression test.
OK czarkoff@,
also proofread by zhuk@ and by Christian Heckendorf <mbie at ulmus dot me>.
-rw-r--r-- | lib/libedit/readline.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index c2666869bc3..51901891582 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readline.c,v 1.21 2016/05/06 13:12:52 schwarze Exp $ */ +/* $OpenBSD: readline.c,v 1.22 2016/05/08 13:34:35 schwarze Exp $ */ /* $NetBSD: readline.c,v 1.91 2010/08/28 15:44:59 christos Exp $ */ /*- @@ -1544,7 +1544,7 @@ history_set_pos(int pos) int curr_num; if (pos >= history_length || pos < 0) - return -1; + return 0; (void)history(h, &ev, H_CURR); curr_num = ev.num; @@ -1555,9 +1555,9 @@ history_set_pos(int pos) */ if (history(h, &ev, H_DELDATA, pos, (void **)-1)) { (void)history(h, &ev, H_SET, curr_num); - return -1; + return 0; } - return 0; + return 1; } @@ -1640,7 +1640,7 @@ history_search_pos(const char *str, return -1; curr_num = ev.num; - if (history_set_pos(off) != 0 || history(h, &ev, H_CURR) != 0) + if (!history_set_pos(off) || history(h, &ev, H_CURR) != 0) return -1; for (;;) { |