stdout: Misc cleanups.
authorAndre Noll <maan@systemlinux.org>
Thu, 31 Dec 2009 03:35:14 +0000 (04:35 +0100)
committerAndre Noll <maan@systemlinux.org>
Thu, 31 Dec 2009 03:35:14 +0000 (04:35 +0100)
stdout.c

index 6539b68f3ff8f91befc8d99cf6b5c3002b2b9e98..d167cd1460225ad964c343b6129aedcac7c73c65 100644 (file)
--- 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;