From 84b0b12f1f485c54f9e78fed1359105c611f8fbf Mon Sep 17 00:00:00 2001
From: Andre Noll <maan@systemlinux.org>
Date: Thu, 31 Dec 2009 04:35:14 +0100
Subject: [PATCH] stdout: Misc cleanups.

---
 stdout.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/stdout.c b/stdout.c
index 6539b68f..d167cd14 100644
--- a/stdout.c
+++ b/stdout.c
@@ -54,8 +54,6 @@ static void stdout_pre_select_btr(struct sched *s, struct task *t)
 	sot->check_fd = 0;
 	if (sz == 0) {
 		if (btr_no_parent(sot->btrn)) {
-			t->error = -E_ORPHAN;
-			btr_del_node(sot->btrn);
 			s->timeout.tv_sec = 0;
 			s->timeout.tv_usec = 1;
 		}
@@ -104,12 +102,11 @@ static void stdout_post_select_btr(struct sched *s, struct task *t)
 	struct stdout_task *sot = container_of(t, struct stdout_task, task);
 	ssize_t ret;
 	size_t sz = btr_get_input_queue_size(sot->btrn);
-	bool orphan = btr_no_parent(sot->btrn);
 	char *buf;
 
 	t->error = 0;
 	if (!sot->check_fd) {
-		if (sz == 0 && orphan) {
+		if (sz == 0 && btr_no_parent(sot->btrn)) {
 			t->error = -E_ORPHAN;
 			goto err;
 		}
@@ -120,7 +117,7 @@ static void stdout_post_select_btr(struct sched *s, struct task *t)
 	sz = btr_next_buffer(sot->btrn, &buf);
 	if (sz == 0)
 		return;
-	ret = write(STDOUT_FILENO, buf, sz);
+	ret = write_nonblock(STDOUT_FILENO, buf, sz, 0);
 	if (ret < 0) {
 		t->error = -ERRNO_TO_PARA_ERROR(errno);
 		goto err;
-- 
2.39.5