[hackers] [sbase] ed: Fix infinite recursion to undo() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Thu, 31 Dec 2015 20:38:21 +0100 (CET)

commit b08660e1fd6935c2b79528fe3c776660474d77c6
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Thu Dec 31 19:35:26 2015 +0000
Commit: sin <sin_AT_2f30.org>
CommitDate: Thu Dec 31 19:38:17 2015 +0000

    ed: Fix infinite recursion to undo()

diff --git a/ed.c b/ed.c
index 8903957..623c6b4 100644
--- a/ed.c
+++ b/ed.c
_AT_@ -282,7 +282,7 @@ undo(void)
         struct link *p;
 
         if (udata.nr == 0)
- error("nothing to undo");
+ return;
         for (p = &udata.vec[udata.nr-1]; udata.nr--; --p) {
                 zero[p->from1].next = p->to1;
                 zero[p->from2].prev = p->to2;
_AT_@ -1101,6 +1101,8 @@ repeat:
                 if (nlines > 0)
                         goto bad_address;
                 chkprint(1);
+ if (udata.nr == 0)
+ error("nothing to undo");
                 undo();
                 break;
         case 's':
Received on Thu Dec 31 2015 - 20:38:21 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 31 2015 - 20:48:06 CET