From: Andre Noll <maan@systemlinux.org>
Date: Tue, 5 Jan 2010 22:05:58 +0000 (+0100)
Subject: stdin: Always set t->error correctly.
X-Git-Tag: v0.4.2~190
X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=2b1f064a6357d027b4c06eee6cf191940726859e;p=paraslash.git

stdin: Always set t->error correctly.
---

diff --git a/stdin.c b/stdin.c
index 8ef325b0..abe69caf 100644
--- 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: