X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=stdout.c;h=4e3b6df9a2582e168c9f144aec44088eb9bc99cc;hp=137030ef272ada72a6f79012f9d65be4cc9eb709;hb=dd2c3baf99ebebaf269e2825a2598a20529a4224;hpb=335730538150250f32c0df0b184fb494e2bb0df3 diff --git a/stdout.c b/stdout.c index 137030ef..4e3b6df9 100644 --- a/stdout.c +++ b/stdout.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Andre Noll + * Copyright (C) 2006-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -8,9 +8,9 @@ #include /* readdir() */ #include +#include #include "para.h" -#include "string.h" #include "list.h" #include "sched.h" #include "fd.h" @@ -62,20 +62,20 @@ static void stdout_post_select(struct sched *s, struct task *t) t->error = 0; if (!sot->check_fd) { - if (*sot->input_error) + if (!*sot->loaded && *sot->input_error < 0) t->error = *sot->input_error; return; } if (!FD_ISSET(STDOUT_FILENO, &s->wfds)) return; - ret = write(STDOUT_FILENO, sot->buf, *sot->loaded); + ret = write(STDOUT_FILENO, *sot->bufp, *sot->loaded); if (ret < 0) { t->error = -ERRNO_TO_PARA_ERROR(errno); return; } *sot->loaded -= ret; if (*sot->loaded) - memmove(sot->buf, sot->buf + ret, *sot->loaded); + memmove(*sot->bufp, *sot->bufp + ret, *sot->loaded); } /** @@ -84,13 +84,13 @@ static void stdout_post_select(struct sched *s, struct task *t) * \param sot The stdout task structure. * * This fills in the pre/post select function poinzters of the task structure - * given by \a sot. It also sets up a default error handler which unregisters - * the task on errors and clears the eof flag of \a sot. + * given by \a sot. */ void stdout_set_defaults(struct stdout_task *sot) { int ret; + sot->use_buffer_tree = false; sot->task.pre_select = stdout_pre_select; sot->task.post_select = stdout_post_select; sprintf(sot->task.status, "stdout writer");