X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2F_info;h=6e95e4ab9e18b7b494b4624ea53f64dd0bd95c15;hb=696c9b68f6334835f13037a83dd5a11c1c8129c7;hp=42b71d9e6e9f18a48b278ddb5beed8a7ec8c4396;hpb=318f717e34e4735e5397bee24dbbee69205be82b;p=ccan diff --git a/ccan/io/_info b/ccan/io/_info index 42b71d9e..6e95e4ab 100644 --- a/ccan/io/_info +++ b/ccan/io/_info @@ -11,7 +11,7 @@ * plans. * * Example: - * // Given tr A-Z a-z outputs tr a-z a-z + * // Given "tr A-Z a-z" outputs tr a-z a-z * #include * #include * #include @@ -61,9 +61,10 @@ * { * // Remove what we just wrote. * b->start += b->wlen; + * b->wlen = 0; * assert(b->start <= sizeof(b->buf)); * - * // If we wrote something, wake writer. + * // If we wrote something, wake reader. * if (b->wlen != 0) * io_wake(b); * @@ -114,6 +115,7 @@ * io_new_conn(NULL, tochild[1], write_out, &to); * * // Read from child, write to stdout. + * memset(&from, 0, sizeof(from)); * reader = io_new_conn(NULL, fromchild[0], read_in, &from); * io_set_finish(reader, finish, &from); * io_new_conn(NULL, STDOUT_FILENO, write_out, &from);