NetBSD-Bugs archive

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

Re: PR/46935 CVS commit: src/lib/libedit



christos%zoulas.com@localhost (Christos Zoulas) wrote:

 |The following reply was made to PR lib/46935; it has been noted by GNATS.
 |
 |From: christos%zoulas.com@localhost (Christos Zoulas)
 |To: Steffen "Daode" Nurpmeso <sdaoden%gmail.com@localhost>, 
gnats-bugs%NetBSD.org@localhost
 |Cc: netbsd-bugs%netbsd.org@localhost, lib-bug-people%netbsd.org@localhost, 
 |      gnats-admin%netbsd.org@localhost
 |Subject: Re: PR/46935 CVS commit: src/lib/libedit
 |Date: Tue, 11 Sep 2012 07:55:15 -0400
 |
 | On Sep 11,  1:15pm, sdaoden%gmail.com@localhost (Steffen "Daode" Nurpmeso) 
wrote:
 | -- Subject: Re: PR/46935 CVS commit: src/lib/libedit
 | 
 || I'm sorry but i have forgotten some bits as below.
 || (errno already set by called fun, *num* has to be mapped.)
 || 
 || --steffen
 || 
 ||     Forgotten bits of errno codeflow
 || ---
 ||  src/lib/libedit/read.c |    3 +--
 ||  1 files changed, 1 insertions(+), 2 deletions(-)
 || 
 || diff --git a/src/lib/libedit/read.c b/src/lib/libedit/read.c
 || index 38d586c..7986394 100644
 || --- a/src/lib/libedit/read.c
 || +++ b/src/lib/libedit/read.c
 || @@ -245,8 +245,7 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, Char \
 |. *ch)
 ||     el->el_errno = 0;
 ||     do {
 ||             if ((num = FUN(el,getc)(el, ch)) != 1) {/* if EOF or error */
 || -                   el->el_errno = num == 0 ? 0 : errno;
 || -                   return num;
 || +                   return (num < 0 ? 1 : 0);
 ||             }
 | 
 | That is supposed to return a CMD; shouldn't it return ED_END_OF_FILE or
 | something?
 | 
 | christos

You're right, simply returning some value !OKCMD seems to be
sufficient.

--steffen

    Forgotten bits of errno codeflow
---
 src/lib/libedit/read.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/lib/libedit/read.c b/src/lib/libedit/read.c
index 38d586c..a1ed1c6 100644
--- a/src/lib/libedit/read.c
+++ b/src/lib/libedit/read.c
@@ -233,7 +233,7 @@ FUN(el,push)(EditLine *el, const Char *str)
 
 
 /* read_getcmd():
- *     Return next command from the input stream.
+ *     Get next command from the input stream, return OKCMD on success.
  *     Character values > 255 are not looked up in the map, but inserted.
  */
 private int
@@ -245,8 +245,7 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, Char *ch)
        el->el_errno = 0;
        do {
                if ((num = FUN(el,getc)(el, ch)) != 1) {/* if EOF or error */
-                       el->el_errno = num == 0 ? 0 : errno;
-                       return num;
+                       return 0;
                }
 
 #ifdef KANJI


Home | Main Index | Thread Index | Old Index