Patch from Vladimir N. Oleynik:
authorEric Andersen <andersen@codepoet.org>
Thu, 19 Aug 2004 18:22:13 +0000 (18:22 -0000)
committerEric Andersen <andersen@codepoet.org>
Thu, 19 Aug 2004 18:22:13 +0000 (18:22 -0000)
On Wed Aug 18, 2004 at 06:52:57PM +0800, Matt Johnston wrote:
> I've come across some strange-seeming behaviour when running programs
> under Busybox (1.0.0-rc3) ash. If the child process sets stdin to be
> non-blocking and then exits, the parent ash will also exit. A quick strace
> shows that a subsequent read() from stdin returns EAGAIN (as would be
> expected):

Thanks!
Patch attached.

--w
vodz

shell/ash.c
shell/cmdedit.c

index 6d1dc603c48884e7f4837dd36cdf289e20ec11af..6c6c28693fd5a18f57db8f03e1761b0fb7156880 100644 (file)
@@ -6062,7 +6062,7 @@ retry:
                        }
                        goto retry;
                }
-               if(nr < 0) {
+               if(nr < 0 && errno == 0) {
                        /* Ctrl+D presend */
                        nr = 0;
                }
index 25d31a0e02eced6032e94d86c6197ac1bfa2d901..56b789ab6c93adc15cf6948e830738353cc91863 100644 (file)
@@ -1297,6 +1297,7 @@ int cmdedit_read_input(char *prompt, char command[BUFSIZ])
                        /* Control-d -- Delete one character, or exit
                         * if the len=0 and no chars to delete */
                        if (len == 0) {
+                                       errno = 0;
 prepare_to_die:
 #if !defined(CONFIG_ASH)
                                printf("exit");