From: Rusty Russell <rusty@rustcorp.com.au>
To: Ian Zimmerman <itz@very.loosely.org>, ccan@lists.ozlabs.org
Subject: Re: Test failure
Date: Mon, 04 Sep 2017 10:21:45 +0930 [thread overview]
Message-ID: <87lglv70bi.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20170902080025.pteplhvgkx4nrzo2@matica.foolinux.mooo.com>
So many bugs in one example program!
There was an unrelated but which strace revealed (trying to write -7
bytes), but I think your issue was more prosaic: failing to zero the
from buffer.
Does this patch fix it for you?
Thanks!
Rusty.
diff --git a/ccan/io/_info b/ccan/io/_info
index fe49df5c..6e95e4ab 100644
--- a/ccan/io/_info
+++ b/ccan/io/_info
@@ -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);
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan
next prev parent reply other threads:[~2017-09-04 1:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-01 3:34 Test failure Ian Zimmerman
2017-09-01 5:09 ` David Gibson
2017-09-01 16:30 ` Ian Zimmerman
2017-09-02 3:50 ` Rusty Russell
2017-09-02 8:00 ` Ian Zimmerman
2017-09-04 0:51 ` Rusty Russell [this message]
2017-09-04 5:32 ` Ian Zimmerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lglv70bi.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=ccan@lists.ozlabs.org \
--cc=itz@very.loosely.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).