Richard W.M. Jones wrote:
..
Subject: [PATCH 1/3] Daemon: fix handling of errors from xread and
xwrite.
If xread or xwrite returns -1, that indicates an error and we
should exit. Note that xread/xwrite has already printed the
error message.
...
- (void) xwrite (sock, buf, xdr_getpos (&xdr));
+ if (xwrite (sock, buf, xdr_getpos (&xdr)) == -1)
+ exit (1);
That all looks fine.
Barely worth mentioning, but when the API makes it equivalent,
I find it slightly more appealing to test " < 0 " rather
than " == -1 ", partly because it covers the entire
range of negative return values, and partly because
it's a little easier to read and shorter.