stdin: Always set t->error correctly.
authorAndre Noll <maan@systemlinux.org>
Tue, 5 Jan 2010 22:05:58 +0000 (23:05 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 5 Jan 2010 22:05:58 +0000 (23:05 +0100)
stdin.c

diff --git a/stdin.c b/stdin.c
index 8ef325b..abe69ca 100644 (file)
--- a/stdin.c
+++ b/stdin.c
@@ -113,12 +113,13 @@ static void stdin_post_select_btr(struct sched *s, struct task *t)
        buf = para_malloc(STDIN_INPUT_BUFFER_SIZE);
        ret = read(STDIN_FILENO, buf, STDIN_INPUT_BUFFER_SIZE);
        //PARA_CRIT_LOG("read ret: %d\n", ret);
-       if (ret < 0)
-               t->error = -ERRNO_TO_PARA_ERROR(errno);
-       if (ret == 0)
-               t->error = -E_STDIN_EOF;
-       if (t->error < 0)
+       if (ret <= 0) {
+               if (ret < 0)
+                       ret = -ERRNO_TO_PARA_ERROR(errno);
+               else
+                       ret = -E_STDIN_EOF;
                goto err;
+       }
        btr_add_output(buf, ret, sit->btrn);
        return;
 err: