On Thu, Aug 20, 2009 at 12:42:47PM +0200, Jim Meyering wrote:
On principle, we shouldn't ignore write failure: [...] - (void) xwrite (sock, lenbuf, 4); - (void) xwrite (sock, buf, len);
What's happening in the original code is that if the daemon can't write its reply message / reply chunk back over the guestfwd socket to the host (library), then it just ignores the error. The code at the moment is wrong - I can't think of any reason why we should ignore this error. If the daemon cannot contact the host, then things have gone badly wrong, so the daemon should exit, which causes an appliance kernel panic, which causes qemu to exit, and the library notices this and informs the caller through either an error result or a callback. So, the code below is better because it checks the return value, but:
+ int err = (xwrite (sock, lenbuf, 4) == 0 + && xwrite (sock, buf, len) == 0 ? 0 : -1); + if (err) + fprintf (stderr, "send_chunk: write failed\n");
I think in this case it should exit(1). If you look at the earlier calls to xwrite in daemon/proto.c:reply() you'll see that those exit. It's the same situation here. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw