diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-03 19:08:19 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-03 19:08:19 +0100 |
commit | d134143b55ecb5f7e6f74318acbf04f9e1370af6 (patch) | |
tree | dd12c32499204fc9967babb5b3207143e644e631 /daemon/guestfsd.c | |
parent | 40ca9a57829f2e82362e391d7d998bf33c8bd671 (diff) | |
download | libguestfs-d134143b55ecb5f7e6f74318acbf04f9e1370af6.tar.gz libguestfs-d134143b55ecb5f7e6f74318acbf04f9e1370af6.tar.xz libguestfs-d134143b55ecb5f7e6f74318acbf04f9e1370af6.zip |
Makes a series of non-trivial calls.
Diffstat (limited to 'daemon/guestfsd.c')
-rw-r--r-- | daemon/guestfsd.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index eaba7f04..6fc8b19f 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -204,6 +204,26 @@ xwrite (int sock, const void *buf, size_t len) } } +void +xread (int sock, void *buf, size_t len) +{ + int r; + + while (len > 0) { + r = read (sock, buf, len); + if (r == -1) { + perror ("read"); + exit (1); + } + if (r == 0) { + fprintf (stderr, "read: unexpected end of file on comms socket\n"); + exit (1); + } + buf += r; + len -= r; + } +} + static void usage (void) { |