Richard W.M. Jones wrote:
From: Richard Jones <rjones(a)trick.home.annexia.org>
This just tidies up the main() function in the daemon. There is
no longer a huge fixed-sized buffer used for the kernel command
line. Variables are moved closer to where they are used. Some
local variables turned out to be unused - these are removed. Finally
the part that reads the kernel command line is moved into a separate
function.
There is only minimal functional change here (it now prints out
the kernel command line).
...
Nicely improved readability.
ACK
+ char lenbuf[4];
+ XDR xdr;
+ uint32_t len = GUESTFS_LAUNCH_FLAG;
+ xdrmem_create (&xdr, lenbuf, sizeof lenbuf, XDR_ENCODE);
+ xdr_uint32_t (&xdr, &len);
- if (xwrite (sock, buf, xdr_getpos (&xdr)) == -1)
+ if (xwrite (sock, lenbuf, 4) == -1)
Can you replace that literal 4 ?
maybe with "sizeof lenbuf"