]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - write_common.c
Add new prebuffer filter.
[paraslash.git] / write_common.c
index 4e81f62d68df57b04617a9e441f244c41cc3ed56..4619d40702338901d3437a4989afaf54889e334d 100644 (file)
@@ -27,6 +27,8 @@ static void wng_pre_select(__a_unused struct sched *s, struct task *t)
 
        FOR_EACH_WRITER_NODE(i, g) {
                struct writer_node *wn = &g->writer_nodes[i];
+               if (!wn->writer->pre_select)
+                       continue;
                t->error = wn->writer->pre_select(s, wn);
                if (t->error < 0)
                        return;
@@ -61,7 +63,7 @@ static void wng_post_select(struct sched *s, struct task *t)
        }
        if (*g->loaded && min_written) {
 //             PARA_INFO_LOG("moving %zd bytes\n", *g->loaded);
-               memmove(g->buf, g->buf + min_written, *g->loaded);
+               memmove(*g->bufp, *g->bufp + min_written, *g->loaded);
        }
 }
 
@@ -97,7 +99,9 @@ err_out:
                struct writer_node *wn = &g->writer_nodes[--i];
                wn->writer->close(wn);
        }
+       free(g->writer_nodes);
        g->num_writers = 0;
+       g->task.error = -E_TASK_UNREGISTERED;
        return ret;
 }