This is a simple helper for dealing with buffered I/O. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>